@ngneat/until-destroy
Advanced tools
Comparing version 7.1.4 to 7.1.5
@@ -11,3 +11,4 @@ (function (global, factory) { | ||
/** | ||
* Applied to instances and stores `Subject` instance | ||
* Applied to instances and stores `Subject` instance when | ||
* no custom destroy method is provided. | ||
*/ | ||
@@ -19,2 +20,17 @@ var DESTROY = Symbol('__destroy'); | ||
var DECORATOR_APPLIED = Symbol('__decoratorApplied'); | ||
/** | ||
* If we use the `untilDestroyed` operator multiple times inside the single | ||
* instance providing different `destroyMethodName`, then all streams will | ||
* subscribe to the single subject. If any method is invoked, the subject will | ||
* emit and all streams will be unsubscribed. We wan't to prevent this behavior, | ||
* thus we store subjects under different symbols. | ||
*/ | ||
function getSymbol(destroyMethodName) { | ||
if (typeof destroyMethodName === 'string') { | ||
return Symbol("__destroy__" + destroyMethodName); | ||
} | ||
else { | ||
return DESTROY; | ||
} | ||
} | ||
function markAsDecorated(providerOrDef) { | ||
@@ -32,14 +48,14 @@ providerOrDef[DECORATOR_APPLIED] = true; | ||
} | ||
function createSubjectOnTheInstance(instance) { | ||
if (!instance[DESTROY]) { | ||
instance[DESTROY] = new rxjs.Subject(); | ||
function createSubjectOnTheInstance(instance, symbol) { | ||
if (!instance[symbol]) { | ||
instance[symbol] = new rxjs.Subject(); | ||
} | ||
} | ||
function completeSubjectOnTheInstance(instance) { | ||
if (instance[DESTROY]) { | ||
instance[DESTROY].next(); | ||
instance[DESTROY].complete(); | ||
function completeSubjectOnTheInstance(instance, symbol) { | ||
if (instance[symbol]) { | ||
instance[symbol].next(); | ||
instance[symbol].complete(); | ||
// We also have to re-assign this property thus in the future | ||
// we will be able to create new subject on the same instance. | ||
instance[DESTROY] = null; | ||
instance[symbol] = null; | ||
} | ||
@@ -75,3 +91,3 @@ } | ||
// that may lead to memory leaks | ||
completeSubjectOnTheInstance(this); | ||
completeSubjectOnTheInstance(this, getSymbol()); | ||
// Check if subscriptions are pushed to some array | ||
@@ -117,3 +133,3 @@ if (arrayName) { | ||
function overrideNonDirectiveInstanceMethod(instance, destroyMethodName) { | ||
function overrideNonDirectiveInstanceMethod(instance, destroyMethodName, symbol) { | ||
var originalDestroy = instance[destroyMethodName]; | ||
@@ -123,6 +139,6 @@ if (isFunction(originalDestroy) === false) { | ||
} | ||
createSubjectOnTheInstance(instance); | ||
createSubjectOnTheInstance(instance, symbol); | ||
instance[destroyMethodName] = function () { | ||
isFunction(originalDestroy) && originalDestroy.apply(this, arguments); | ||
completeSubjectOnTheInstance(this); | ||
completeSubjectOnTheInstance(this, symbol); | ||
// We have to re-assign this property back to the original value. | ||
@@ -137,12 +153,13 @@ // If the `untilDestroyed` operator is called for the same instance | ||
return function (source) { | ||
var symbol = getSymbol(destroyMethodName); | ||
// If `destroyMethodName` is passed then the developer applies | ||
// this operator to something non-related to Angular DI system | ||
if (typeof destroyMethodName === 'string') { | ||
overrideNonDirectiveInstanceMethod(instance, destroyMethodName); | ||
overrideNonDirectiveInstanceMethod(instance, destroyMethodName, symbol); | ||
} | ||
else { | ||
ensureClassIsDecorated(instance); | ||
createSubjectOnTheInstance(instance); | ||
createSubjectOnTheInstance(instance, symbol); | ||
} | ||
return source.pipe(operators.takeUntil(instance[DESTROY])); | ||
return source.pipe(operators.takeUntil(instance[symbol])); | ||
}; | ||
@@ -149,0 +166,0 @@ } |
@@ -1,2 +0,2 @@ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@ngneat/until-destroy",["exports","rxjs","rxjs/operators"],n):n(((t=t||self).ngneat=t.ngneat||{},t.ngneat["until-destroy"]={}),t.rxjs,t.rxjs.operators)}(this,(function(t,n,r){"use strict";function e(t){return"function"==typeof t}var o=Symbol("__destroy"),i=Symbol("__decoratorApplied");function s(t){t[i]=!0}function u(t){t[o]||(t[o]=new n.Subject)}function c(t){t[o]&&(t[o].next(),t[o].complete(),t[o]=null)}function f(t){return t.ɵcmp||t.ɵdir}function a(t){return!!t.ɵprov}function p(t){t&&e(t.unsubscribe)&&t.unsubscribe()}function d(t,n){var r=n.arrayName,e=n.checkProperties,o=n.blackList;return function(){if(t&&t.call(this),c(this),r)return function(t){Array.isArray(t)&&t.forEach(p)}(this[r]);if(e)for(var n in this)o&&o.includes(n)||p(this[n])}}t.UntilDestroy=function(t){return void 0===t&&(t={}),function(n){a(n)?function(t,n){t.prototype.ngOnDestroy=d(t.prototype.ngOnDestroy,n),s(t)}(n,t):function(t,n){var r=f(t);r.onDestroy=d(r.onDestroy,n),s(r)}(n,t)}},t.untilDestroyed=function(t,n){return function(s){return"string"==typeof n?function(t,n){var r=t[n];if(!1===e(r))throw new Error(t.constructor.name+" is using untilDestroyed but doesn't implement "+n);u(t),t[n]=function(){e(r)&&r.apply(this,arguments),c(this),t[n]=r}}(t,n):(!function(t){var n=t.constructor;if(!(a(n)?n:f(n))[i])throw new Error("untilDestroyed operator cannot be used inside directives or components or providers that are not decorated with UntilDestroy decorator")}(t),u(t)),s.pipe(r.takeUntil(t[o]))}},Object.defineProperty(t,"__esModule",{value:!0})})); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@ngneat/until-destroy",["exports","rxjs","rxjs/operators"],n):n(((t=t||self).ngneat=t.ngneat||{},t.ngneat["until-destroy"]={}),t.rxjs,t.rxjs.operators)}(this,(function(t,n,r){"use strict";function e(t){return"function"==typeof t}var o=Symbol("__destroy"),i=Symbol("__decoratorApplied");function s(t){return"string"==typeof t?Symbol("__destroy__"+t):o}function u(t){t[i]=!0}function c(t,r){t[r]||(t[r]=new n.Subject)}function f(t,n){t[n]&&(t[n].next(),t[n].complete(),t[n]=null)}function a(t){return t.ɵcmp||t.ɵdir}function p(t){return!!t.ɵprov}function d(t){t&&e(t.unsubscribe)&&t.unsubscribe()}function y(t,n){var r=n.arrayName,e=n.checkProperties,o=n.blackList;return function(){if(t&&t.call(this),f(this,s()),r)return function(t){Array.isArray(t)&&t.forEach(d)}(this[r]);if(e)for(var n in this)o&&o.includes(n)||d(this[n])}}t.UntilDestroy=function(t){return void 0===t&&(t={}),function(n){p(n)?function(t,n){t.prototype.ngOnDestroy=y(t.prototype.ngOnDestroy,n),u(t)}(n,t):function(t,n){var r=a(t);r.onDestroy=y(r.onDestroy,n),u(r)}(n,t)}},t.untilDestroyed=function(t,n){return function(o){var u=s(n);return"string"==typeof n?function(t,n,r){var o=t[n];if(!1===e(o))throw new Error(t.constructor.name+" is using untilDestroyed but doesn't implement "+n);c(t,r),t[n]=function(){e(o)&&o.apply(this,arguments),f(this,r),t[n]=o}}(t,n,u):(!function(t){var n=t.constructor;if(!(p(n)?n:a(n))[i])throw new Error("untilDestroyed operator cannot be used inside directives or components or providers that are not decorated with UntilDestroy decorator")}(t),c(t,u)),o.pipe(r.takeUntil(t[u]))}},Object.defineProperty(t,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=ngneat-until-destroy.umd.min.js.map |
@@ -6,5 +6,6 @@ import { Subject } from 'rxjs'; | ||
/** | ||
* Applied to instances and stores `Subject` instance | ||
* Applied to instances and stores `Subject` instance when | ||
* no custom destroy method is provided. | ||
*/ | ||
export const DESTROY = Symbol('__destroy'); | ||
const DESTROY = Symbol('__destroy'); | ||
/** | ||
@@ -14,2 +15,17 @@ * Applied to definitions and informs that class is decorated | ||
const DECORATOR_APPLIED = Symbol('__decoratorApplied'); | ||
/** | ||
* If we use the `untilDestroyed` operator multiple times inside the single | ||
* instance providing different `destroyMethodName`, then all streams will | ||
* subscribe to the single subject. If any method is invoked, the subject will | ||
* emit and all streams will be unsubscribed. We wan't to prevent this behavior, | ||
* thus we store subjects under different symbols. | ||
*/ | ||
export function getSymbol(destroyMethodName) { | ||
if (typeof destroyMethodName === 'string') { | ||
return Symbol(`__destroy__${destroyMethodName}`); | ||
} | ||
else { | ||
return DESTROY; | ||
} | ||
} | ||
export function markAsDecorated(providerOrDef) { | ||
@@ -27,14 +43,14 @@ providerOrDef[DECORATOR_APPLIED] = true; | ||
} | ||
export function createSubjectOnTheInstance(instance) { | ||
if (!instance[DESTROY]) { | ||
instance[DESTROY] = new Subject(); | ||
export function createSubjectOnTheInstance(instance, symbol) { | ||
if (!instance[symbol]) { | ||
instance[symbol] = new Subject(); | ||
} | ||
} | ||
export function completeSubjectOnTheInstance(instance) { | ||
if (instance[DESTROY]) { | ||
instance[DESTROY].next(); | ||
instance[DESTROY].complete(); | ||
export function completeSubjectOnTheInstance(instance, symbol) { | ||
if (instance[symbol]) { | ||
instance[symbol].next(); | ||
instance[symbol].complete(); | ||
// We also have to re-assign this property thus in the future | ||
// we will be able to create new subject on the same instance. | ||
instance[DESTROY] = null; | ||
instance[symbol] = null; | ||
} | ||
@@ -56,2 +72,2 @@ } | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZXJuYWxzLmpzIiwic291cmNlUm9vdCI6Im5nOi8vQG5nbmVhdC91bnRpbC1kZXN0cm95LyIsInNvdXJjZXMiOlsibGliL2ludGVybmFscy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFPQSxPQUFPLEVBQUUsT0FBTyxFQUFFLE1BQU0sTUFBTSxDQUFDO0FBRS9CLE1BQU0sVUFBVSxVQUFVLENBQUMsTUFBZTtJQUN4QyxPQUFPLE9BQU8sTUFBTSxLQUFLLFVBQVUsQ0FBQztBQUN0QyxDQUFDO0FBRUQ7O0dBRUc7QUFDSCxNQUFNLENBQUMsTUFBTSxPQUFPLEdBQWtCLE1BQU0sQ0FBQyxXQUFXLENBQUMsQ0FBQztBQUUxRDs7R0FFRztBQUNILE1BQU0saUJBQWlCLEdBQWtCLE1BQU0sQ0FBQyxvQkFBb0IsQ0FBQyxDQUFDO0FBRXRFLE1BQU0sVUFBVSxlQUFlLENBQzdCLGFBQXNGO0lBRXJGLGFBQXFCLENBQUMsaUJBQWlCLENBQUMsR0FBRyxJQUFJLENBQUM7QUFDbkQsQ0FBQztBQVFELE1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b21lIGZ1bmN0aW9uXG4gKiBkZWNvcmF0ZWQgd2l0aCBgQEluamVjdGFibGUoKWBcbiAqL1xuZXhwb3J0IGZ1bmN0aW9uIGlzSW5qZWN0YWJsZVR5cGUodGFyZ2V0OiBhbnkpOiB0YXJnZXQgaXMgSW5qZWN0YWJsZVR5cGU8dW5rbm93bj4ge1xuICByZXR1cm4gISF0YXJnZXQuybVwcm92O1xufVxuIl19 |
@@ -1,2 +0,2 @@ | ||
import { getDef, isFunction, completeSubjectOnTheInstance, isInjectableType, markAsDecorated } from './internals'; | ||
import { getDef, getSymbol, isFunction, completeSubjectOnTheInstance, isInjectableType, markAsDecorated } from './internals'; | ||
function unsubscribe(property) { | ||
@@ -14,3 +14,3 @@ property && isFunction(property.unsubscribe) && property.unsubscribe(); | ||
// that may lead to memory leaks | ||
completeSubjectOnTheInstance(this); | ||
completeSubjectOnTheInstance(this, getSymbol()); | ||
// Check if subscriptions are pushed to some array | ||
@@ -54,2 +54,2 @@ if (arrayName) { | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidW50aWwtZGVzdHJveS5qcyIsInNvdXJjZVJvb3QiOiJuZzovL0BuZ25lYXQvdW50aWwtZGVzdHJveS8iLCJzb3VyY2VzIjpbImxpYi91bnRpbC1kZXN0cm95LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU1BLE9BQU8sRUFDTCxNQUFNLEVBQ04sVUFBVSxFQUVWLDRCQUE0QixFQUM1QixnQkFBZ0IsRUFDaEIsZUFBZSxFQUNoQixNQUFNLGFBQWEsQ0FBQztBQUVyQixTQUFTLFdBQVcsQ0FBQyxRQUFhO0lBQ2hDLFFBQVEsSUFBSSxVQUFVLENBQUMsUUFBUSxDQUFDLFdBQVcsQ0FBQyxJQUFJLFFBQVEsQ0FBQyxXQUFXLEVBQUUsQ0FBQztBQUN6RSxDQUFDO0FBRUQsU0FBUyxnQ0FBZ0MsQ0FBQyxRQU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zdHJveShvcHRpb25zOiBVbnRpbERlc3Ryb3lPcHRpb25zID0ge30pOiBDbGFzc0RlY29yYXRvciB7XG4gIHJldHVybiAodGFyZ2V0OiBhbnkpID0+IHtcbiAgICBpZiAoaXNJbmplY3RhYmxlVHlwZSh0YXJnZXQpKSB7XG4gICAgICBkZWNvcmF0ZVByb3ZpZGVyKHRhcmdldCwgb3B0aW9ucyk7XG4gICAgfSBlbHNlIHtcbiAgICAgIGRlY29yYXRlRGlyZWN0aXZlKHRhcmdldCwgb3B0aW9ucyk7XG4gICAgfVxuICB9O1xufVxuIl19 |
import { takeUntil } from 'rxjs/operators'; | ||
import { DESTROY, isFunction, createSubjectOnTheInstance, completeSubjectOnTheInstance, ensureClassIsDecorated } from './internals'; | ||
function overrideNonDirectiveInstanceMethod(instance, destroyMethodName) { | ||
import { getSymbol, isFunction, createSubjectOnTheInstance, completeSubjectOnTheInstance, ensureClassIsDecorated } from './internals'; | ||
function overrideNonDirectiveInstanceMethod(instance, destroyMethodName, symbol) { | ||
const originalDestroy = instance[destroyMethodName]; | ||
@@ -8,6 +8,6 @@ if (isFunction(originalDestroy) === false) { | ||
} | ||
createSubjectOnTheInstance(instance); | ||
createSubjectOnTheInstance(instance, symbol); | ||
instance[destroyMethodName] = function () { | ||
isFunction(originalDestroy) && originalDestroy.apply(this, arguments); | ||
completeSubjectOnTheInstance(this); | ||
completeSubjectOnTheInstance(this, symbol); | ||
// We have to re-assign this property back to the original value. | ||
@@ -22,14 +22,15 @@ // If the `untilDestroyed` operator is called for the same instance | ||
return (source) => { | ||
const symbol = getSymbol(destroyMethodName); | ||
// If `destroyMethodName` is passed then the developer applies | ||
// this operator to something non-related to Angular DI system | ||
if (typeof destroyMethodName === 'string') { | ||
overrideNonDirectiveInstanceMethod(instance, destroyMethodName); | ||
overrideNonDirectiveInstanceMethod(instance, destroyMethodName, symbol); | ||
} | ||
else { | ||
ensureClassIsDecorated(instance); | ||
createSubjectOnTheInstance(instance); | ||
createSubjectOnTheInstance(instance, symbol); | ||
} | ||
return source.pipe(takeUntil(instance[DESTROY])); | ||
return source.pipe(takeUntil(instance[symbol])); | ||
}; | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidW50aWwtZGVzdHJveWVkLmpzIiwic291cmNlUm9vdCI6Im5nOi8vQG5nbmVhdC91bnRpbC1kZXN0cm95LyIsInNvdXJjZXMiOlsibGliL3VudGlsLWRlc3Ryb3llZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEVBQUUsU0FBUyxFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFFM0MsT0FBTyxFQUNMLE9BQU8sRUFDUCxVQUFVLEVBQ1YsMEJBQTBCLEVBQzFCLDRCQUE0QixFQUM1QixzQkFBc0IsRUFDdkIsTUFBTSxhQUFhLENBQUM7QUFFckIsU0FBUyxrQ0FBa0MsQ0FBQyxRQUFhLEVBQUUsaUJBQXlCO0lBQ2xGLE1BQU0sZUFBZSxHQUFHLFFBQVEsQ0FBQyxpQkFBaUIsQ0FBQyxDQUFDO0lBRXBELElBQUksVUFBVSxDQUFDLGVBQWUsQ0FBQyxLQUFLLEtBQUssRUFBRTtRQUN6QyxNQUFNLElBQUksS0FBSyxDQUNiLEdBQUcsUUFBUSxDQUFDLFdBQVcsQ0FBQyxJQUFJLGtEQUFrRCxpQkFBaUIsRUFBRSxDQUNsRyxDQUFDO0tBQ0g7SUFFRCwwQkFBMEIsQ0FBQyxRQUFRLENBQUMsQ0FBQztJQUVyQyxRQUFRLENBQUMsaUJBQWlCLENBQUMsR0FBRztRQUM1QixVQUFVLENBQUMsZUFBZSxDQUFDLElBQUksZUFBZSxDQUFDLEtBQUssQ0FBQyxJQUFJLEVBQUUsU0FBUyxDQUFDLENBQUM7UUFDdEUsNEJBQTRCLENBQUMsSUFBSSxDQUFDLENBQUM7UUFDbkMsaUVBQWlFO1FBQ2pFLG1FQUFtRTtRQUNuRSwyRE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XRob2ROYW1lYCBpcyBwYXNzZWQgdGhlbiB0aGUgZGV2ZWxvcGVyIGFwcGxpZXNcbiAgICAvLyB0aGlzIG9wZXJhdG9yIHRvIHNvbWV0aGluZyBub24tcmVsYXRlZCB0byBBbmd1bGFyIERJIHN5c3RlbVxuICAgIGlmICh0eXBlb2YgZGVzdHJveU1ldGhvZE5hbWUgPT09ICdzdHJpbmcnKSB7XG4gICAgICBvdmVycmlkZU5vbkRpcmVjdGl2ZUluc3RhbmNlTWV0aG9kKGluc3RhbmNlLCBkZXN0cm95TWV0aG9kTmFtZSwgc3ltYm9sKTtcbiAgICB9IGVsc2Uge1xuICAgICAgZW5zdXJlQ2xhc3NJc0RlY29yYXRlZChpbnN0YW5jZSk7XG4gICAgICBjcmVhdGVTdWJqZWN0T25UaGVJbnN0YW5jZShpbnN0YW5jZSwgc3ltYm9sKTtcbiAgICB9XG5cbiAgICByZXR1cm4gc291cmNlLnBpcGUodGFrZVVudGlsPFU+KChpbnN0YW5jZSBhcyBhbnkpW3N5bWJvbF0pKTtcbiAgfTtcbn1cbiJdfQ== |
@@ -6,5 +6,6 @@ import { Subject } from 'rxjs'; | ||
/** | ||
* Applied to instances and stores `Subject` instance | ||
* Applied to instances and stores `Subject` instance when | ||
* no custom destroy method is provided. | ||
*/ | ||
export var DESTROY = Symbol('__destroy'); | ||
var DESTROY = Symbol('__destroy'); | ||
/** | ||
@@ -14,2 +15,17 @@ * Applied to definitions and informs that class is decorated | ||
var DECORATOR_APPLIED = Symbol('__decoratorApplied'); | ||
/** | ||
* If we use the `untilDestroyed` operator multiple times inside the single | ||
* instance providing different `destroyMethodName`, then all streams will | ||
* subscribe to the single subject. If any method is invoked, the subject will | ||
* emit and all streams will be unsubscribed. We wan't to prevent this behavior, | ||
* thus we store subjects under different symbols. | ||
*/ | ||
export function getSymbol(destroyMethodName) { | ||
if (typeof destroyMethodName === 'string') { | ||
return Symbol("__destroy__" + destroyMethodName); | ||
} | ||
else { | ||
return DESTROY; | ||
} | ||
} | ||
export function markAsDecorated(providerOrDef) { | ||
@@ -27,14 +43,14 @@ providerOrDef[DECORATOR_APPLIED] = true; | ||
} | ||
export function createSubjectOnTheInstance(instance) { | ||
if (!instance[DESTROY]) { | ||
instance[DESTROY] = new Subject(); | ||
export function createSubjectOnTheInstance(instance, symbol) { | ||
if (!instance[symbol]) { | ||
instance[symbol] = new Subject(); | ||
} | ||
} | ||
export function completeSubjectOnTheInstance(instance) { | ||
if (instance[DESTROY]) { | ||
instance[DESTROY].next(); | ||
instance[DESTROY].complete(); | ||
export function completeSubjectOnTheInstance(instance, symbol) { | ||
if (instance[symbol]) { | ||
instance[symbol].next(); | ||
instance[symbol].complete(); | ||
// We also have to re-assign this property thus in the future | ||
// we will be able to create new subject on the same instance. | ||
instance[DESTROY] = null; | ||
instance[symbol] = null; | ||
} | ||
@@ -56,2 +72,2 @@ } | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZXJuYWxzLmpzIiwic291cmNlUm9vdCI6Im5nOi8vQG5nbmVhdC91bnRpbC1kZXN0cm95LyIsInNvdXJjZXMiOlsibGliL2ludGVybmFscy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFPQSxPQUFPLEVBQUUsT0FBTyxFQUFFLE1BQU0sTUFBTSxDQUFDO0FBRS9CLE1BQU0sVUFBVSxVQUFVLENBQUMsTUFBZTtJQUN4QyxPQUFPLE9BQU8sTUFBTSxLQUFLLFVBQVUsQ0FBQztBQUN0QyxDQUFDO0FBRUQ7O0dBRUc7QUFDSCxNQUFNLENBQUMsSUFBTSxPQUFPLEdBQWtCLE1BQU0sQ0FBQyxXQUFXLENBQUMsQ0FBQztBQUUxRDs7R0FFRztBQUNILElBQU0saUJBQWlCLEdBQWtCLE1BQU0sQ0FBQyxvQkFBb0IsQ0FBQyxDQUFDO0FBRXRFLE1BQU0sVUFBVSxlQUFlLENBQzdCLGFBQXNGO0lBRXJGLGFBQ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n1cblxuLyoqXG4gKiBEZXRlcm1pbmVzIHdoZXRoZXIgdGhlIHByb3ZpZGVkIGB0YXJnZXRgIGlzIHNvbWUgZnVuY3Rpb25cbiAqIGRlY29yYXRlZCB3aXRoIGBASW5qZWN0YWJsZSgpYFxuICovXG5leHBvcnQgZnVuY3Rpb24gaXNJbmplY3RhYmxlVHlwZSh0YXJnZXQ6IGFueSk6IHRhcmdldCBpcyBJbmplY3RhYmxlVHlwZTx1bmtub3duPiB7XG4gIHJldHVybiAhIXRhcmdldC7JtXByb3Y7XG59XG4iXX0= |
@@ -1,2 +0,2 @@ | ||
import { getDef, isFunction, completeSubjectOnTheInstance, isInjectableType, markAsDecorated } from './internals'; | ||
import { getDef, getSymbol, isFunction, completeSubjectOnTheInstance, isInjectableType, markAsDecorated } from './internals'; | ||
function unsubscribe(property) { | ||
@@ -15,3 +15,3 @@ property && isFunction(property.unsubscribe) && property.unsubscribe(); | ||
// that may lead to memory leaks | ||
completeSubjectOnTheInstance(this); | ||
completeSubjectOnTheInstance(this, getSymbol()); | ||
// Check if subscriptions are pushed to some array | ||
@@ -56,2 +56,2 @@ if (arrayName) { | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidW50aWwtZGVzdHJveS5qcyIsInNvdXJjZVJvb3QiOiJuZzovL0BuZ25lYXQvdW50aWwtZGVzdHJveS8iLCJzb3VyY2VzIjpbImxpYi91bnRpbC1kZXN0cm95LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU1BLE9BQU8sRUFDTCxNQUFNLEVBQ04sVUFBVSxFQUVWLDRCQUE0QixFQUM1QixnQkFBZ0IsRUFDaEIsZUFBZSxFQUNoQixNQUFNLGFBQWEsQ0FBQztBQUVyQixTQUFTLFdBQVcsQ0FBQyxRQUFhO0lBQ2hDLFFBQVEsSUFBSSxVQUFVLENBQUMsUUFBUSxDQUFDLFdBQVcsQ0FBQyxJQUFJLFFBQVEsQ0FBQ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3Ryb3ksIG9wdGlvbnMpO1xuICBtYXJrQXNEZWNvcmF0ZWQoZGVmKTtcbn1cblxuZXhwb3J0IGZ1bmN0aW9uIFVudGlsRGVzdHJveShvcHRpb25zOiBVbnRpbERlc3Ryb3lPcHRpb25zID0ge30pOiBDbGFzc0RlY29yYXRvciB7XG4gIHJldHVybiAodGFyZ2V0OiBhbnkpID0+IHtcbiAgICBpZiAoaXNJbmplY3RhYmxlVHlwZSh0YXJnZXQpKSB7XG4gICAgICBkZWNvcmF0ZVByb3ZpZGVyKHRhcmdldCwgb3B0aW9ucyk7XG4gICAgfSBlbHNlIHtcbiAgICAgIGRlY29yYXRlRGlyZWN0aXZlKHRhcmdldCwgb3B0aW9ucyk7XG4gICAgfVxuICB9O1xufVxuIl19 |
import { takeUntil } from 'rxjs/operators'; | ||
import { DESTROY, isFunction, createSubjectOnTheInstance, completeSubjectOnTheInstance, ensureClassIsDecorated } from './internals'; | ||
function overrideNonDirectiveInstanceMethod(instance, destroyMethodName) { | ||
import { getSymbol, isFunction, createSubjectOnTheInstance, completeSubjectOnTheInstance, ensureClassIsDecorated } from './internals'; | ||
function overrideNonDirectiveInstanceMethod(instance, destroyMethodName, symbol) { | ||
var originalDestroy = instance[destroyMethodName]; | ||
@@ -8,6 +8,6 @@ if (isFunction(originalDestroy) === false) { | ||
} | ||
createSubjectOnTheInstance(instance); | ||
createSubjectOnTheInstance(instance, symbol); | ||
instance[destroyMethodName] = function () { | ||
isFunction(originalDestroy) && originalDestroy.apply(this, arguments); | ||
completeSubjectOnTheInstance(this); | ||
completeSubjectOnTheInstance(this, symbol); | ||
// We have to re-assign this property back to the original value. | ||
@@ -22,14 +22,15 @@ // If the `untilDestroyed` operator is called for the same instance | ||
return function (source) { | ||
var symbol = getSymbol(destroyMethodName); | ||
// If `destroyMethodName` is passed then the developer applies | ||
// this operator to something non-related to Angular DI system | ||
if (typeof destroyMethodName === 'string') { | ||
overrideNonDirectiveInstanceMethod(instance, destroyMethodName); | ||
overrideNonDirectiveInstanceMethod(instance, destroyMethodName, symbol); | ||
} | ||
else { | ||
ensureClassIsDecorated(instance); | ||
createSubjectOnTheInstance(instance); | ||
createSubjectOnTheInstance(instance, symbol); | ||
} | ||
return source.pipe(takeUntil(instance[DESTROY])); | ||
return source.pipe(takeUntil(instance[symbol])); | ||
}; | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidW50aWwtZGVzdHJveWVkLmpzIiwic291cmNlUm9vdCI6Im5nOi8vQG5nbmVhdC91bnRpbC1kZXN0cm95LyIsInNvdXJjZXMiOlsibGliL3VudGlsLWRlc3Ryb3llZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEVBQUUsU0FBUyxFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFFM0MsT0FBTyxFQUNMLE9BQU8sRUFDUCxVQUFVLEVBQ1YsMEJBQTBCLEVBQzFCLDRCQUE0QixFQUM1QixzQkFBc0IsRUFDdkIsTUFBTSxhQUFhLENBQUM7QUFFckIsU0FBUyxrQ0FBa0MsQ0FBQyxRQUFhLEVBQUUsaUJBQXlCO0lBQ2xGLElBQU0sZUFBZSxHQUFHLFFBQVEsQ0FBQyxpQkFBaUIsQ0FBQyxDQUFDO0lBRXBELElBQUksVUFBVSxDQUFDLGVBQWUsQ0FBQyxLQUFLLEtBQUssRUFBRTtRQUN6QyxNQUFNLElBQUksS0FBSyxDQUNWLFFBQVEsQ0FBQyxXQUFXLENBQUMsSUFBSSx1REFBa0QsaUJBQW1CLENBQ2xHLENBQUM7S0FDSDtJQUVELDBCQUEwQixDQUFDLFFBQVEsQ0FBQyxDQUFDO0lBRXJDLFFBQVEsQ0FBQyxpQkFBaUIsQ0FBQyxHQUFHO1FBQzVCLFVBQVUsQ0FBQyxlQUFlLENBQUMsSUFBSSxlQUFlLENBQUMsS0FBSyxDQUFDLElBQUksRUFBRSxTQUFTLENBQUMsQ0FBQztRQUN0RS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KGRlc3Ryb3lNZXRob2ROYW1lKTtcblxuICAgIC8vIElmIGBkZXN0cm95TWV0aG9kTmFtZWAgaXMgcGFzc2VkIHRoZW4gdGhlIGRldmVsb3BlciBhcHBsaWVzXG4gICAgLy8gdGhpcyBvcGVyYXRvciB0byBzb21ldGhpbmcgbm9uLXJlbGF0ZWQgdG8gQW5ndWxhciBESSBzeXN0ZW1cbiAgICBpZiAodHlwZW9mIGRlc3Ryb3lNZXRob2ROYW1lID09PSAnc3RyaW5nJykge1xuICAgICAgb3ZlcnJpZGVOb25EaXJlY3RpdmVJbnN0YW5jZU1ldGhvZChpbnN0YW5jZSwgZGVzdHJveU1ldGhvZE5hbWUsIHN5bWJvbCk7XG4gICAgfSBlbHNlIHtcbiAgICAgIGVuc3VyZUNsYXNzSXNEZWNvcmF0ZWQoaW5zdGFuY2UpO1xuICAgICAgY3JlYXRlU3ViamVjdE9uVGhlSW5zdGFuY2UoaW5zdGFuY2UsIHN5bWJvbCk7XG4gICAgfVxuXG4gICAgcmV0dXJuIHNvdXJjZS5waXBlKHRha2VVbnRpbDxVPigoaW5zdGFuY2UgYXMgYW55KVtzeW1ib2xdKSk7XG4gIH07XG59XG4iXX0= |
@@ -8,3 +8,4 @@ import { Subject } from 'rxjs'; | ||
/** | ||
* Applied to instances and stores `Subject` instance | ||
* Applied to instances and stores `Subject` instance when | ||
* no custom destroy method is provided. | ||
*/ | ||
@@ -16,2 +17,17 @@ const DESTROY = Symbol('__destroy'); | ||
const DECORATOR_APPLIED = Symbol('__decoratorApplied'); | ||
/** | ||
* If we use the `untilDestroyed` operator multiple times inside the single | ||
* instance providing different `destroyMethodName`, then all streams will | ||
* subscribe to the single subject. If any method is invoked, the subject will | ||
* emit and all streams will be unsubscribed. We wan't to prevent this behavior, | ||
* thus we store subjects under different symbols. | ||
*/ | ||
function getSymbol(destroyMethodName) { | ||
if (typeof destroyMethodName === 'string') { | ||
return Symbol(`__destroy__${destroyMethodName}`); | ||
} | ||
else { | ||
return DESTROY; | ||
} | ||
} | ||
function markAsDecorated(providerOrDef) { | ||
@@ -29,14 +45,14 @@ providerOrDef[DECORATOR_APPLIED] = true; | ||
} | ||
function createSubjectOnTheInstance(instance) { | ||
if (!instance[DESTROY]) { | ||
instance[DESTROY] = new Subject(); | ||
function createSubjectOnTheInstance(instance, symbol) { | ||
if (!instance[symbol]) { | ||
instance[symbol] = new Subject(); | ||
} | ||
} | ||
function completeSubjectOnTheInstance(instance) { | ||
if (instance[DESTROY]) { | ||
instance[DESTROY].next(); | ||
instance[DESTROY].complete(); | ||
function completeSubjectOnTheInstance(instance, symbol) { | ||
if (instance[symbol]) { | ||
instance[symbol].next(); | ||
instance[symbol].complete(); | ||
// We also have to re-assign this property thus in the future | ||
// we will be able to create new subject on the same instance. | ||
instance[DESTROY] = null; | ||
instance[symbol] = null; | ||
} | ||
@@ -71,3 +87,3 @@ } | ||
// that may lead to memory leaks | ||
completeSubjectOnTheInstance(this); | ||
completeSubjectOnTheInstance(this, getSymbol()); | ||
// Check if subscriptions are pushed to some array | ||
@@ -112,3 +128,3 @@ if (arrayName) { | ||
function overrideNonDirectiveInstanceMethod(instance, destroyMethodName) { | ||
function overrideNonDirectiveInstanceMethod(instance, destroyMethodName, symbol) { | ||
const originalDestroy = instance[destroyMethodName]; | ||
@@ -118,6 +134,6 @@ if (isFunction(originalDestroy) === false) { | ||
} | ||
createSubjectOnTheInstance(instance); | ||
createSubjectOnTheInstance(instance, symbol); | ||
instance[destroyMethodName] = function () { | ||
isFunction(originalDestroy) && originalDestroy.apply(this, arguments); | ||
completeSubjectOnTheInstance(this); | ||
completeSubjectOnTheInstance(this, symbol); | ||
// We have to re-assign this property back to the original value. | ||
@@ -132,12 +148,13 @@ // If the `untilDestroyed` operator is called for the same instance | ||
return (source) => { | ||
const symbol = getSymbol(destroyMethodName); | ||
// If `destroyMethodName` is passed then the developer applies | ||
// this operator to something non-related to Angular DI system | ||
if (typeof destroyMethodName === 'string') { | ||
overrideNonDirectiveInstanceMethod(instance, destroyMethodName); | ||
overrideNonDirectiveInstanceMethod(instance, destroyMethodName, symbol); | ||
} | ||
else { | ||
ensureClassIsDecorated(instance); | ||
createSubjectOnTheInstance(instance); | ||
createSubjectOnTheInstance(instance, symbol); | ||
} | ||
return source.pipe(takeUntil(instance[DESTROY])); | ||
return source.pipe(takeUntil(instance[symbol])); | ||
}; | ||
@@ -144,0 +161,0 @@ } |
@@ -8,3 +8,4 @@ import { Subject } from 'rxjs'; | ||
/** | ||
* Applied to instances and stores `Subject` instance | ||
* Applied to instances and stores `Subject` instance when | ||
* no custom destroy method is provided. | ||
*/ | ||
@@ -16,2 +17,17 @@ var DESTROY = Symbol('__destroy'); | ||
var DECORATOR_APPLIED = Symbol('__decoratorApplied'); | ||
/** | ||
* If we use the `untilDestroyed` operator multiple times inside the single | ||
* instance providing different `destroyMethodName`, then all streams will | ||
* subscribe to the single subject. If any method is invoked, the subject will | ||
* emit and all streams will be unsubscribed. We wan't to prevent this behavior, | ||
* thus we store subjects under different symbols. | ||
*/ | ||
function getSymbol(destroyMethodName) { | ||
if (typeof destroyMethodName === 'string') { | ||
return Symbol("__destroy__" + destroyMethodName); | ||
} | ||
else { | ||
return DESTROY; | ||
} | ||
} | ||
function markAsDecorated(providerOrDef) { | ||
@@ -29,14 +45,14 @@ providerOrDef[DECORATOR_APPLIED] = true; | ||
} | ||
function createSubjectOnTheInstance(instance) { | ||
if (!instance[DESTROY]) { | ||
instance[DESTROY] = new Subject(); | ||
function createSubjectOnTheInstance(instance, symbol) { | ||
if (!instance[symbol]) { | ||
instance[symbol] = new Subject(); | ||
} | ||
} | ||
function completeSubjectOnTheInstance(instance) { | ||
if (instance[DESTROY]) { | ||
instance[DESTROY].next(); | ||
instance[DESTROY].complete(); | ||
function completeSubjectOnTheInstance(instance, symbol) { | ||
if (instance[symbol]) { | ||
instance[symbol].next(); | ||
instance[symbol].complete(); | ||
// We also have to re-assign this property thus in the future | ||
// we will be able to create new subject on the same instance. | ||
instance[DESTROY] = null; | ||
instance[symbol] = null; | ||
} | ||
@@ -72,3 +88,3 @@ } | ||
// that may lead to memory leaks | ||
completeSubjectOnTheInstance(this); | ||
completeSubjectOnTheInstance(this, getSymbol()); | ||
// Check if subscriptions are pushed to some array | ||
@@ -114,3 +130,3 @@ if (arrayName) { | ||
function overrideNonDirectiveInstanceMethod(instance, destroyMethodName) { | ||
function overrideNonDirectiveInstanceMethod(instance, destroyMethodName, symbol) { | ||
var originalDestroy = instance[destroyMethodName]; | ||
@@ -120,6 +136,6 @@ if (isFunction(originalDestroy) === false) { | ||
} | ||
createSubjectOnTheInstance(instance); | ||
createSubjectOnTheInstance(instance, symbol); | ||
instance[destroyMethodName] = function () { | ||
isFunction(originalDestroy) && originalDestroy.apply(this, arguments); | ||
completeSubjectOnTheInstance(this); | ||
completeSubjectOnTheInstance(this, symbol); | ||
// We have to re-assign this property back to the original value. | ||
@@ -134,12 +150,13 @@ // If the `untilDestroyed` operator is called for the same instance | ||
return function (source) { | ||
var symbol = getSymbol(destroyMethodName); | ||
// If `destroyMethodName` is passed then the developer applies | ||
// this operator to something non-related to Angular DI system | ||
if (typeof destroyMethodName === 'string') { | ||
overrideNonDirectiveInstanceMethod(instance, destroyMethodName); | ||
overrideNonDirectiveInstanceMethod(instance, destroyMethodName, symbol); | ||
} | ||
else { | ||
ensureClassIsDecorated(instance); | ||
createSubjectOnTheInstance(instance); | ||
createSubjectOnTheInstance(instance, symbol); | ||
} | ||
return source.pipe(takeUntil(instance[DESTROY])); | ||
return source.pipe(takeUntil(instance[symbol])); | ||
}; | ||
@@ -146,0 +163,0 @@ } |
import { InjectableType, ɵComponentType as ComponentType, ɵDirectiveType as DirectiveType, ɵComponentDef as ComponentDef, ɵDirectiveDef as DirectiveDef } from '@angular/core'; | ||
export declare function isFunction(target: unknown): boolean; | ||
/** | ||
* Applied to instances and stores `Subject` instance | ||
* If we use the `untilDestroyed` operator multiple times inside the single | ||
* instance providing different `destroyMethodName`, then all streams will | ||
* subscribe to the single subject. If any method is invoked, the subject will | ||
* emit and all streams will be unsubscribed. We wan't to prevent this behavior, | ||
* thus we store subjects under different symbols. | ||
*/ | ||
export declare const DESTROY: unique symbol; | ||
export declare function getSymbol<T>(destroyMethodName?: keyof T): symbol; | ||
export declare function markAsDecorated(providerOrDef: InjectableType<unknown> | DirectiveDef<unknown> | ComponentDef<unknown>): void; | ||
@@ -14,4 +18,4 @@ export interface UntilDestroyOptions { | ||
export declare function ensureClassIsDecorated(instance: any): never | void; | ||
export declare function createSubjectOnTheInstance(instance: any): void; | ||
export declare function completeSubjectOnTheInstance(instance: any): void; | ||
export declare function createSubjectOnTheInstance(instance: any, symbol: symbol): void; | ||
export declare function completeSubjectOnTheInstance(instance: any, symbol: symbol): void; | ||
/** | ||
@@ -18,0 +22,0 @@ * As directive and component definitions are considered private API, |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":4,"metadata":{"UntilDestroy":{"__symbolic":"function","parameters":["options"],"defaults":[{}],"value":{"__symbolic":"error","message":"Lambda not supported","line":72,"character":9,"module":"./lib/until-destroy"}},"untilDestroyed":{"__symbolic":"function","parameters":["instance","destroyMethodName"],"value":{"__symbolic":"error","message":"Lambda not supported","line":34,"character":9,"module":"./lib/until-destroyed"}}},"origins":{"UntilDestroy":"./lib/until-destroy","untilDestroyed":"./lib/until-destroyed"},"importAs":"@ngneat/until-destroy"} | ||
{"__symbolic":"module","version":4,"metadata":{"UntilDestroy":{"__symbolic":"function","parameters":["options"],"defaults":[{}],"value":{"__symbolic":"error","message":"Lambda not supported","line":73,"character":9,"module":"./lib/until-destroy"}},"untilDestroyed":{"__symbolic":"function","parameters":["instance","destroyMethodName"],"value":{"__symbolic":"error","message":"Lambda not supported","line":38,"character":9,"module":"./lib/until-destroyed"}}},"origins":{"UntilDestroy":"./lib/until-destroy","untilDestroyed":"./lib/until-destroyed"},"importAs":"@ngneat/until-destroy"} |
@@ -5,3 +5,3 @@ { | ||
"description": "RxJS operator that unsubscribes when Angular component is destroyed", | ||
"version": "7.1.4", | ||
"version": "7.1.5", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "type": "git", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
119830
844