{"id":14973485,"url":"https://github.com/orchestratora/ngx-until-destroyed","last_synced_at":"2025-10-01T23:30:57.111Z","repository":{"id":57134182,"uuid":"166104232","full_name":"orchestratora/ngx-until-destroyed","owner":"orchestratora","description":"🤓 RxJS operator that unsubscribes from observable on Angular component destruction","archived":false,"fork":true,"pushed_at":"2019-01-17T01:15:43.000Z","size":441,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-02T13:09:11.762Z","etag":null,"topics":["angular","components","destroy","operator","rxjs","unsubscribe"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"gund/ngx-take-until-destroy","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/orchestratora.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-16T20:08:23.000Z","updated_at":"2020-08-25T17:43:59.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/orchestratora/ngx-until-destroyed","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orchestratora%2Fngx-until-destroyed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orchestratora%2Fngx-until-destroyed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orchestratora%2Fngx-until-destroyed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orchestratora%2Fngx-until-destroyed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/orchestratora","download_url":"https://codeload.github.com/orchestratora/ngx-until-destroyed/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234909088,"owners_count":18905505,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["angular","components","destroy","operator","rxjs","unsubscribe"],"created_at":"2024-09-24T13:48:50.280Z","updated_at":"2025-10-01T23:30:56.720Z","avatar_url":"https://github.com/orchestratora.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🤓 Angular - Unsubscribe For Pros 💪\n\n[![Build Status](https://travis-ci.org/orchestratora/ngx-until-destroyed.svg?branch=master)](https://travis-ci.org/orchestratora/ngx-until-destroyed)\n[![Coverage](https://img.shields.io/codecov/c/github/orchestratora/ngx-until-destroyed.svg?maxAge=2592000)](https://codecov.io/gh/orchestratora/ngx-until-destroyed)\n[![Npm](https://img.shields.io/npm/v/@orchestrator/ngx-until-destroyed.svg)](https://www.npmjs.com/package/@orchestrator/ngx-until-destroyed)\n[![Npm Downloads](https://img.shields.io/npm/dt/@orchestrator/ngx-until-destroyed.svg)](https://www.npmjs.com/package/@orchestrator/ngx-until-destroyed)\n![Licence](https://img.shields.io/github/license/orchestratora/ngx-until-destroyed.svg)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n\n\u003e Declarative way to unsubscribe from observables when the component destroyed\n\n## Installation\n\n```bash\n$ npm install @orchestrator/ngx-until-destroyed --save\n```\n\n## Usage\n\n```ts\nimport { untilDestroyed } from '@orchestrator/ngx-until-destroyed';\n\n@Component({\n  selector: 'app-inbox',\n  templateUrl: './inbox.component.html',\n})\nexport class InboxComponent implements OnInit, OnDestroy {\n  ngOnInit() {\n    interval(1000)\n      .pipe(untilDestroyed(this))\n      .subscribe(val =\u003e console.log(val));\n  }\n\n  // This method must be present, even if empty.\n  ngOnDestroy() {\n    // To protect you, we'll throw an error if it doesn't exist.\n  }\n}\n```\n\n### Use with decorator\n\n```ts\nimport { WithUntilDestroyed } from '@orchestrator/ngx-until-destroyed';\n\n@Component({...})\nclass MyComponent implements OnDestroy {\n  @WithUntilDestroyed()\n  stream$ = interval(1000); // You can safely subscribe to this everywhere\n\n  // This method must be present, even if empty\n  ngOnDestroy() {}\n}\n```\n\n### Use with any class\n\n```ts\nimport { untilDestroyed } from '@orchestrator/ngx-until-destroyed';\n\nexport class Widget {\n  constructor() {\n    interval(1000)\n      .pipe(untilDestroyed(this, 'destroy'))\n      .subscribe(console.log);\n  }\n\n  // The name needs to be the same as the decorator parameter\n  destroy() {}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forchestratora%2Fngx-until-destroyed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Forchestratora%2Fngx-until-destroyed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forchestratora%2Fngx-until-destroyed/lists"}