Last active
March 21, 2020 20:35
-
-
Save NyaGarcia/a48e9cfdd433af06bfd1c4ada9ed6541 to your computer and use it in GitHub Desktop.
Manually unsubscribing from multiple observables
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
const pokemonSubscription = pokemon$.subscribe(pokemon => { | |
// Do something with pokemon | |
}); | |
const trainerSubscription = trainer$.subscribe(trainer => { | |
// Do something with trainer | |
}); | |
const numberSubscription = number$.subscribe(number => { | |
// Do something with number | |
}); | |
function stop() { | |
pokemonSubscription.unsubscribe(); | |
trainerSubscription.unsubscribe(); | |
numberSubscription.unsubscribe(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment