Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ngx-auto-unsubscribe

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngx-auto-unsubscribe - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

14

__tests__/auto-unsubscribe.spec.ts

@@ -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');

});
});

5

dist/auto-unsubscribe.js

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc