{"id":50753423,"url":"https://github.com/basu-dev/multi-subscription","last_synced_at":"2026-06-11T03:02:39.530Z","repository":{"id":57305126,"uuid":"399855846","full_name":"basu-dev/multi-subscription","owner":"basu-dev","description":"A npm package to unsubscribe multiple rxjs subscriptions at once, the easiest method out there.","archived":false,"fork":false,"pushed_at":"2021-08-25T17:32:15.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-08T06:43:30.187Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/basu-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-25T14:49:52.000Z","updated_at":"2021-08-25T17:35:40.000Z","dependencies_parsed_at":"2022-09-09T23:10:25.066Z","dependency_job_id":null,"html_url":"https://github.com/basu-dev/multi-subscription","commit_stats":null,"previous_names":["basu-dev/multisubscription"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/basu-dev/multi-subscription","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basu-dev%2Fmulti-subscription","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basu-dev%2Fmulti-subscription/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basu-dev%2Fmulti-subscription/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basu-dev%2Fmulti-subscription/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/basu-dev","download_url":"https://codeload.github.com/basu-dev/multi-subscription/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basu-dev%2Fmulti-subscription/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34180147,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-11T02:00:06.485Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2026-06-11T03:02:38.034Z","updated_at":"2026-06-11T03:02:39.531Z","avatar_url":"https://github.com/basu-dev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MultiSubscription\n\n**Unsubscribes multiple RXJS subscription at once.**\n\nIt is the easiest implementation for unsubscribing multiple RXJS subscriptions at once.\nIts an easier alternative to SubSink.\n\n\u003e You can use it with any frameworks that uses RXJS subscriptions line Angular, Nest etc.\n\n\u003e Adds only 400 bytes to your production bundle.\n\n## Installation\n\n```bash\nnpm install multi-subscription --save\n```\n\n## Examples\n\nAs you can see in the code below, we declare only one subscription variable and decorate it with `@MultiSubscription()` decorator, use that same variable for all subscriptions and unsubscribe tha one subscription at the end.\u003cbr\u003e\n\n.\n\n```ts\nimport {MultiSubscription } from \"multisubscription\"\n.\n.\nexport class ChildComponent implements OnInit {\n\n  @MultiSubscription()\n  sub!: Subscription;\n\n  ngOnInit() {\n    this.sub = interval(1000).subscribe(data =\u003e {\n      console.log('%cChild Component 1', 'font-weight: bold;color:red', data);\n\n    });\n\n    this.sub = interval(1000).subscribe(data =\u003e {\n      console.log('%cChild Component 1', 'font-weight: bold;color:blue', data);\n    });\n\n    this.sub = interval(1000).subscribe(data =\u003e {\n      console.log('%cChild Component 1', 'font-weight: bold', data);\n    });\n  }\n\n  ngOnDestroy() {\n    this.sub.unsubscribe();\n  }\n}\n```\n\nIn the above example, we have three subscriptions which are all unsubscribed at once when we call `unsubscribe()` method inside `ngOnDestroy()`.\n\n## How does it work\n\nWhat the decorator does is it collects all the subscriptions inside an array under the hood and when you call unsubscribe on that one subscription variable it unsubscribes all the other subscriptions and clears the array.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasu-dev%2Fmulti-subscription","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbasu-dev%2Fmulti-subscription","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasu-dev%2Fmulti-subscription/lists"}