Created
September 12, 2020 02:48
-
-
Save zachgoll/801c3f84557e3d4903863ec8cefafd19 to your computer and use it in GitHub Desktop.
This file contains 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 { interval } = Rx; | |
const { map, take } = RxOperators; | |
// The input observable will emit the values 1, 2, 3 | |
// in 1 second intervals | |
function inputObservable() { | |
const returnValues = [1, 2, 3]; | |
return interval(1000) | |
.pipe( | |
take(returnValues.length), | |
map(val => returnValues[val]) | |
); | |
} | |
// ===================================== | |
// Don't worry about anything above this | |
// | |
// Just know that the input Observable | |
// returns the values 1, 2, 3 | |
// ===================================== | |
inputObservable().pipe( | |
take(2) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment