Skip to content

Instantly share code, notes, and snippets.

@ronnyek
Created September 18, 2019 20:26
Show Gist options
  • Select an option

  • Save ronnyek/400146fde1dd768096934f91255a495e to your computer and use it in GitHub Desktop.

Select an option

Save ronnyek/400146fde1dd768096934f91255a495e to your computer and use it in GitHub Desktop.
export function Unsubscribable<T extends Constructor<{}>>(Base: T) {
class WithUnsubscribable extends Base implements OnDestroy {
protected unsubscribeAll: Subject<any> = new Subject();
ngOnDestroy(): void {
this.unsubscribeAll.next();
this.unsubscribeAll.complete();
}
}
return WithUnsubscribable;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment