@badisi/ngx-safe-subscribe 4.0.27 → 4.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -17,8 +17,8 @@
17
17
 
18
18
  <p align="center">
19
19
  <a href="https://github.com/Badisi/ngx-safe-subscribe/actions/workflows/ci_tests.yml">
20
- <img src="https://github.com/Badisi/ngx-safe-subscribe/actions/workflows/ci_tests.yml/badge.svg" alt="build status" /></a>
21
- <a href="https://github.com/badisi/ngx-safe-subscribe/blob/main/CONTRIBUTING.md#-submitting-a-pull-request-pr">
20
+ <img src="https://img.shields.io/github/actions/workflow/status/badisi/ngx-safe-subscribe/ci_tests.yml?logo=github" alt="build status" /></a>
21
+ <a href="https://github.com/Badisi/ngx-safe-subscribe/blob/main/CONTRIBUTING.md#-submitting-a-pull-request-pr">
22
22
  <img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs welcome" /></a>
23
23
  </p>
24
24
 
@@ -146,5 +146,5 @@ Please read and follow the [Code of Conduct][codeofconduct] and help me keep thi
146
146
 
147
147
 
148
148
 
149
- [contributing]: https://github.com/badisi/latest-version/blob/main/CONTRIBUTING.md
150
- [codeofconduct]: https://github.com/badisi/latest-version/blob/main/CODE_OF_CONDUCT.md
149
+ [contributing]: https://github.com/Badisi/latest-version/blob/main/CONTRIBUTING.md
150
+ [codeofconduct]: https://github.com/Badisi/latest-version/blob/main/CODE_OF_CONDUCT.md
@@ -1 +1 @@
1
- {"version":3,"file":"badisi-ngx-safe-subscribe.mjs","sources":["../../ngx-safe-subscribe.ts","../../badisi-ngx-safe-subscribe.ts"],"sourcesContent":["import { Observable, Subscription } from 'rxjs';\n\nconst HAS_DECORATOR = Symbol('__safeSubscribeDecorator');\nconst SUBSCRIPTION = Symbol('__safeSubscribeSubscription$');\n\ndeclare module 'rxjs/internal/Observable' {\n interface Observable<T> {\n safeSubscribe: typeof safeSubscribe;\n }\n}\n\nexport function SafeSubscribe(destructorName ='ngOnDestroy'): ClassDecorator {\n return (classType: Function) => {\n const originalDestroy = classType.prototype[destructorName];\n classType.prototype[destructorName] = function (this: any) {\n originalDestroy && originalDestroy.call(this);\n this[SUBSCRIPTION]?.unsubscribe();\n this[SUBSCRIPTION] = null;\n }\n classType.prototype[HAS_DECORATOR] = true;\n };\n}\n\nexport function safeSubscribe<T>(this: Observable<T>, target: any, ...args: any): Subscription {\n const sub = this.subscribe(...args);\n if (target) {\n const hasDecorator = Object.getPrototypeOf(target)[HAS_DECORATOR];\n if (!hasDecorator) {\n throw new Error(`${target.constructor.name} class must be decorated with @SafeSubscribe() otherwise Observable<T>.safeSubscribe() will have no effect.`);\n }\n if (!target[SUBSCRIPTION]) {\n target[SUBSCRIPTION] = new Subscription();\n }\n target[SUBSCRIPTION].add(sub);\n }\n return sub;\n}\nObservable.prototype.safeSubscribe = safeSubscribe;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './ngx-safe-subscribe';\n"],"names":[],"mappings":";;AAEA,MAAM,aAAa,GAAG,MAAM,CAAC,0BAA0B,CAAC;AACxD,MAAM,YAAY,GAAG,MAAM,CAAC,8BAA8B,CAAC;AAQ3C,SAAA,aAAa,CAAC,cAAc,GAAE,aAAa,EAAA;IACvD,OAAO,CAAC,SAAmB,KAAI;QAC3B,MAAM,eAAe,GAAG,SAAS,CAAC,SAAS,CAAC,cAAc,CAAC;AAC3D,QAAA,SAAS,CAAC,SAAS,CAAC,cAAc,CAAC,GAAG,YAAA;AAClC,YAAA,eAAe,IAAI,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC;AAC7C,YAAA,IAAI,CAAC,YAAY,CAAC,EAAE,WAAW,EAAE;AACjC,YAAA,IAAI,CAAC,YAAY,CAAC,GAAG,IAAI;AAC7B,SAAC;AACD,QAAA,SAAS,CAAC,SAAS,CAAC,aAAa,CAAC,GAAG,IAAI;AAC7C,KAAC;AACL;SAEgB,aAAa,CAAyB,MAAW,EAAE,GAAG,IAAS,EAAA;IAC3E,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;IACnC,IAAI,MAAM,EAAE;QACR,MAAM,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC;QACjE,IAAI,CAAC,YAAY,EAAE;YACf,MAAM,IAAI,KAAK,CAAC,CAAG,EAAA,MAAM,CAAC,WAAW,CAAC,IAAI,CAA6G,2GAAA,CAAA,CAAC;;AAE5J,QAAA,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE;AACvB,YAAA,MAAM,CAAC,YAAY,CAAC,GAAG,IAAI,YAAY,EAAE;;QAE7C,MAAM,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;;AAEjC,IAAA,OAAO,GAAG;AACd;AACA,UAAU,CAAC,SAAS,CAAC,aAAa,GAAG,aAAa;;ACrClD;;AAEG;;;;"}
1
+ {"version":3,"file":"badisi-ngx-safe-subscribe.mjs","sources":["../../ngx-safe-subscribe.ts","../../badisi-ngx-safe-subscribe.ts"],"sourcesContent":["import { Observable, Subscription } from 'rxjs';\n\nconst HAS_DECORATOR = Symbol('__safeSubscribeDecorator');\nconst SUBSCRIPTION = Symbol('__safeSubscribeSubscription$');\n\ndeclare module 'rxjs/internal/Observable' {\n interface Observable<T> {\n safeSubscribe: typeof safeSubscribe;\n }\n}\n\nexport function SafeSubscribe(destructorName ='ngOnDestroy'): ClassDecorator {\n return (classType: Function) => {\n const originalDestroy = classType.prototype[destructorName];\n classType.prototype[destructorName] = function (this: any) {\n originalDestroy && originalDestroy.call(this);\n this[SUBSCRIPTION]?.unsubscribe();\n this[SUBSCRIPTION] = null;\n }\n classType.prototype[HAS_DECORATOR] = true;\n };\n}\n\nexport function safeSubscribe<T>(this: Observable<T>, target: any, ...args: any): Subscription {\n const sub = this.subscribe(...args);\n if (target) {\n const hasDecorator = Object.getPrototypeOf(target)[HAS_DECORATOR];\n if (!hasDecorator) {\n throw new Error(`${target.constructor.name} class must be decorated with @SafeSubscribe() otherwise Observable<T>.safeSubscribe() will have no effect.`);\n }\n if (!target[SUBSCRIPTION]) {\n target[SUBSCRIPTION] = new Subscription();\n }\n target[SUBSCRIPTION].add(sub);\n }\n return sub;\n}\nObservable.prototype.safeSubscribe = safeSubscribe;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './ngx-safe-subscribe';\n"],"names":[],"mappings":";;AAEA,MAAM,aAAa,GAAG,MAAM,CAAC,0BAA0B,CAAC;AACxD,MAAM,YAAY,GAAG,MAAM,CAAC,8BAA8B,CAAC;AAQrD,SAAU,aAAa,CAAC,cAAc,GAAE,aAAa,EAAA;IACvD,OAAO,CAAC,SAAmB,KAAI;QAC3B,MAAM,eAAe,GAAG,SAAS,CAAC,SAAS,CAAC,cAAc,CAAC;AAC3D,QAAA,SAAS,CAAC,SAAS,CAAC,cAAc,CAAC,GAAG,YAAA;AAClC,YAAA,eAAe,IAAI,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC;AAC7C,YAAA,IAAI,CAAC,YAAY,CAAC,EAAE,WAAW,EAAE;AACjC,YAAA,IAAI,CAAC,YAAY,CAAC,GAAG,IAAI;AAC7B,QAAA,CAAC;AACD,QAAA,SAAS,CAAC,SAAS,CAAC,aAAa,CAAC,GAAG,IAAI;AAC7C,IAAA,CAAC;AACL;SAEgB,aAAa,CAAyB,MAAW,EAAE,GAAG,IAAS,EAAA;IAC3E,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;IACnC,IAAI,MAAM,EAAE;QACR,MAAM,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC;QACjE,IAAI,CAAC,YAAY,EAAE;YACf,MAAM,IAAI,KAAK,CAAC,CAAA,EAAG,MAAM,CAAC,WAAW,CAAC,IAAI,CAAA,2GAAA,CAA6G,CAAC;QAC5J;AACA,QAAA,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE;AACvB,YAAA,MAAM,CAAC,YAAY,CAAC,GAAG,IAAI,YAAY,EAAE;QAC7C;QACA,MAAM,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IACjC;AACA,IAAA,OAAO,GAAG;AACd;AACA,UAAU,CAAC,SAAS,CAAC,aAAa,GAAG,aAAa;;ACrClD;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@badisi/ngx-safe-subscribe",
3
- "version": "4.0.27",
3
+ "version": "4.0.29",
4
4
  "description": "Easy way to automatically unsubscribe from RxJS observables in Angular components",
5
- "homepage": "https://github.com/badisi/ngx-safe-subscribe",
5
+ "homepage": "https://github.com/Badisi/ngx-safe-subscribe",
6
6
  "license": "MIT",
7
7
  "sideEffects": true,
8
8
  "author": {
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "repository": {
12
12
  "type": "git",
13
- "url": "git+https://github.com/badisi/ngx-safe-subscribe.git"
13
+ "url": "https://github.com/Badisi/ngx-safe-subscribe"
14
14
  },
15
15
  "keywords": [
16
16
  "angular",