ngx-auto-unsubscribe
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -42,2 +42,14 @@ import { AutoUnsubscribe } from '../src/auto-unsubscribe'; | ||
it('should not warn when disable AOT mode', () => { | ||
window['disableAutoUnsubscribeAot'] = true; | ||
const consoleSpy = jest.spyOn(console, 'warn'); | ||
@AutoUnsubscribe() | ||
class TodsComponent { | ||
obs = mockObservable; | ||
} | ||
new TodsComponent()['ngOnDestroy'](); | ||
expect(consoleSpy).not.toHaveBeenCalled(); | ||
}); | ||
it('should not warn when disable AOT mode with typo', () => { | ||
window['disableAuthUnsubscribeAot'] = true; | ||
@@ -103,2 +115,2 @@ const consoleSpy = jest.spyOn(console, 'warn'); | ||
}); | ||
}); |
@@ -8,3 +8,3 @@ function isFunction(fn) { | ||
var original = constructor.prototype.ngOnDestroy; | ||
if (!isFunction(original) && !window['disableAuthUnsubscribeAot']) { | ||
if (!isFunction(original) && !disableAutoUnsubscribeAot()) { | ||
console.warn(constructor.name + " is using @AutoUnsubscribe but does not implement OnDestroy"); | ||
@@ -21,3 +21,6 @@ } | ||
}; | ||
function disableAutoUnsubscribeAot() { | ||
return window['disableAutoUnsubscribeAot'] || window['disableAuthUnsubscribeAot']; | ||
} | ||
} | ||
//# sourceMappingURL=auto-unsubscribe.js.map |
{ | ||
"name": "ngx-auto-unsubscribe", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "description": "Class decorator that automatically unsubscribes from observables and events", |
@@ -17,4 +17,2 @@ ### Angular - Auto Unsubscribe For Pros | ||
// you can also do @AutoUnsubscribe({ includeArrays: true }) | ||
// if you want to unsubscribe from arrays of observables (default is false) | ||
@AutoUnsubscribe() | ||
@@ -44,1 +42,10 @@ @Component({ | ||
### Options | ||
| Option | Description | Default Value | | ||
| -------------------- | ------------------------------------------------------------------ | ---------------- | | ||
| `includeArrays` | unsubscribe from arrays of observables | `false` | | ||
| `blackList` | an array of properties to exclude | `[]` | | ||
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
10340
142
50