{"id":19042010,"url":"https://github.com/writetome51/unsubscribe-on-destroy-directive","last_synced_at":"2026-05-16T09:35:22.261Z","repository":{"id":38806691,"uuid":"163804682","full_name":"writetome51/unsubscribe-on-destroy-directive","owner":"writetome51","description":"Abstract Angular class that unsubscribes from all subscriptions during ngOnDestroy()","archived":false,"fork":false,"pushed_at":"2022-06-02T21:06:55.000Z","size":22,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-24T16:56:42.096Z","etag":null,"topics":["abstract","abstract-class","angular","class","component","typescript","unsubscribe"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/writetome51.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-02T06:47:45.000Z","updated_at":"2020-11-26T08:54:58.000Z","dependencies_parsed_at":"2022-09-18T10:21:59.805Z","dependency_job_id":null,"html_url":"https://github.com/writetome51/unsubscribe-on-destroy-directive","commit_stats":null,"previous_names":["writetome51/unsubscribe-on-destroy-component"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/writetome51/unsubscribe-on-destroy-directive","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/writetome51%2Funsubscribe-on-destroy-directive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/writetome51%2Funsubscribe-on-destroy-directive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/writetome51%2Funsubscribe-on-destroy-directive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/writetome51%2Funsubscribe-on-destroy-directive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/writetome51","download_url":"https://codeload.github.com/writetome51/unsubscribe-on-destroy-directive/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/writetome51%2Funsubscribe-on-destroy-directive/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33097009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-16T04:41:52.686Z","status":"ssl_error","status_checked_at":"2026-05-16T04:41:52.009Z","response_time":115,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["abstract","abstract-class","angular","class","component","typescript","unsubscribe"],"created_at":"2024-11-08T22:33:56.312Z","updated_at":"2026-05-16T09:35:22.239Z","avatar_url":"https://github.com/writetome51.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# UnsubscribeOnDestroyDirective\n\nAn abstract Angular directive class that any Angular directive class which uses  \n[Subscriptions](https://rxjs-dev.firebaseapp.com/api/index/class/Subscription) can extend \nfrom.\n\nDuring the `ngOnDestroy()` hook, it unsubscribes from all Subscriptions inside   \n`this._subscriptions`. \nHave your component classes that use Subscriptions  \ninherit from this class, add their subscriptions to `this._subscriptions`, then let  \nthis class automatically unsubscribe from all of them during `ngOnDestroy()`.  \n\n\n## Example\n```\nexport class ExamplePageComponent extends UnsubscribeOnDestroyDirective\n    implements AfterViewInit {\n\n    ngAfterViewInit() {\n        this._subscriptions = this._subscriptions.concat(\n            // Add any subscriptions this component is using to this array:\n            [\n                this.subscriptionOne,\n                this.subscriptionTwo,\n                // ...\n            ]\n        );\n    }\n\n}\n``` \n\n## Properties\n```\nprotected _subscriptions: Array\u003c{ unsubscribe: () =\u003e any }\u003e\n```\n\n\n## Methods\n```\nngOnDestroy() : void\n``` \n\n\n## Installation\n\n`npm i  @writetome51/unsubscribe-on-destroy-directive`\n\n## Loading\n```ts\nimport { UnsubscribeOnDestroyDirective } \n\tfrom '@writetome51/unsubscribe-on-destroy-directive';\n```\n\n## License\n[MIT](https://choosealicense.com/licenses/mit/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwritetome51%2Funsubscribe-on-destroy-directive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwritetome51%2Funsubscribe-on-destroy-directive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwritetome51%2Funsubscribe-on-destroy-directive/lists"}