Skip to content

Instantly share code, notes, and snippets.

@briandilley
Created April 2, 2018 21:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save briandilley/36f38b0c66dd8b30dc8123e656be1cf9 to your computer and use it in GitHub Desktop.
Save briandilley/36f38b0c66dd8b30dc8123e656be1cf9 to your computer and use it in GitHub Desktop.
export class BaseRxComponent
implements OnDestroy {
private subscription: Subscription = new Subscription();
protected manage(teardown: TeardownLogic): Subscription {
return this.subscription.add(teardown);
}
protected unsubscribe(): void {
this.subscription.unsubscribe();
this.subscription = new Subscription();
}
public ngOnDestroy(): void {
this.unsubscribe();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment