Last active
June 25, 2019 06:45
-
-
Save BibbyChung/2ec39f72e39933466cbafafd57a0715f to your computer and use it in GitHub Desktop.
easy to unsubscribe...
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
import { Subscription } from 'rxjs'; | |
declare module 'rxjs/internal/Subscription' { | |
interface Subscription { | |
toUnsubscription( | |
this: Subscription, | |
sub: Subscription | |
): void; | |
} | |
} | |
Subscription.prototype.toUnsubscription = | |
function ( | |
this: Subscription, | |
sub: Subscription | |
): void { | |
sub.add(this); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how to use it