Created
September 18, 2019 20:26
-
-
Save ronnyek/400146fde1dd768096934f91255a495e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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