All Projects → NetanelBasal → Ngx Auto Unsubscribe

NetanelBasal / Ngx Auto Unsubscribe

Licence: mit
Class decorator that will automatically unsubscribe from observables

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Ngx Auto Unsubscribe

Ayanami
🍭 A better way to react with state
Stars: ✭ 129 (-61.72%)
Mutual labels:  rxjs, decorators
Until Destroy
🦊 RxJS operator that unsubscribe from observables on destroy
Stars: ✭ 1,071 (+217.8%)
Mutual labels:  rxjs, decorators
Dugong
Minimal State Store Manager for React Apps using RxJS
Stars: ✭ 10 (-97.03%)
Mutual labels:  rxjs, decorators
bind-observable
Provides a typescript decorator which binds class properties to observable companion properties.
Stars: ✭ 15 (-95.55%)
Mutual labels:  rxjs, decorators
Fluorine
[UNMAINTAINED] Reactive state and side effect management for React using a single stream of actions
Stars: ✭ 287 (-14.84%)
Mutual labels:  rxjs
axios-for-observable
A RxJS wrapper for axios, same api as axios absolutely
Stars: ✭ 13 (-96.14%)
Mutual labels:  rxjs
observable-playground
Know your Observables before deploying to production
Stars: ✭ 96 (-71.51%)
Mutual labels:  rxjs
vue-decorator
Custom decorators to vue-class-component that fits Vue 3
Stars: ✭ 31 (-90.8%)
Mutual labels:  decorators
Warthog
GraphQL API Framework with strong conventions and auto-generated schema
Stars: ✭ 316 (-6.23%)
Mutual labels:  decorators
Ngx Responsive
Superset of RESPONSIVE DIRECTIVES to show or hide items according to the size of the device screen and another features in Angular 9
Stars: ✭ 300 (-10.98%)
Mutual labels:  rxjs
Exploring Async
An essay exploring different async techniques in JavaScript.
Stars: ✭ 280 (-16.91%)
Mutual labels:  rxjs
Rxweb
Tons of extensively featured packages for Angular, VUE and React Projects
Stars: ✭ 262 (-22.26%)
Mutual labels:  decorators
Nestcloud
A NodeJS micro-service solution, writing by Typescript language and NestJS framework.
Stars: ✭ 290 (-13.95%)
Mutual labels:  decorators
ng-radio
RxJS-based message bus service for Angular2
Stars: ✭ 12 (-96.44%)
Mutual labels:  rxjs
Coderplanets web
the most sexiest community for developers, build with React, Mobx/MST, GraphQL, Styled-Components, Rxjs, Ramda ... and ❤️
Stars: ✭ 314 (-6.82%)
Mutual labels:  rxjs
giuseppe
A controller routing system for expressJS with TypeScript decorators and annotations
Stars: ✭ 49 (-85.46%)
Mutual labels:  decorators
Pebble
Multi threading and processing eye-candy.
Stars: ✭ 276 (-18.1%)
Mutual labels:  decorators
Hstardoc
My blogs write with markdown.
Stars: ✭ 297 (-11.87%)
Mutual labels:  rxjs
Decorator
Function decorators for Elixir
Stars: ✭ 278 (-17.51%)
Mutual labels:  decorators
Rxjs Marbles
An RxJS marble testing library for any test framework
Stars: ✭ 267 (-20.77%)
Mutual labels:  rxjs

Angular - Auto Unsubscribe For Pros

npm Build Status Build Status npm Awesome

For Angular 9+, use until-destroy

Class decorator that will automatically unsubscribe from observable subscriptions when the component is destroyed

Installation

npm install ngx-auto-unsubscribe --save

Usage

import { AutoUnsubscribe } from "ngx-auto-unsubscribe";

@AutoUnsubscribe()
@Component({
  selector: 'inbox'
})
export class InboxComponent {
  one: Subscription;
  two: Subscription;

  constructor( private store: Store<any>, private element : ElementRef ) {}

  ngOnInit() {
    this.one = store.select("data").subscribe(data => // do something);
    this.two = Observable.interval.subscribe(data => // do something);
  }

  // This method must be present, even if empty.
  ngOnDestroy() {
    // We'll throw an error if it doesn't
  }
}

Options

Option Description Default Value
arrayName unsubscribe from subscriptions only in specified array ''
blackList an array of properties to exclude []
event a name of event callback to execute on ngOnDestroy

Note: blackList is ignored if arrayName is specified.

Similar projects

You can also use https://github.com/NetanelBasal/ngx-take-until-destroy.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].