Created
August 23, 2016 20:49
-
-
Save uk-ar/09f901486c6ba138b451528bebf65dc7 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
> node | |
var Rx = require('rx'); | |
var source = Rx.Observable.interval(500 /* ms */).timeInterval().take(3); | |
var source = Rx.Observable.from([1,2]); | |
var source = Rx.Observable.interval(1000).do(i=>console.log("s:",i)).map( | |
n=>{if(n === 2) { | |
throw 'ex'; | |
} | |
return n; | |
}).retryWhen(function(errors) { | |
return errors.delay(200); | |
}).take(6).do(i=>console.log("e:",i)) | |
var source = Rx.Observable.from([0,1,2,3,4,5]).do(i=>console.log("s:",i)).map( | |
n=>{if(n === 2) { | |
throw 'ex'; | |
} | |
return n; | |
}).retryWhen(function(errors) { | |
return errors.delay(200); | |
}).take(6).do(i=>console.log("e:",i)).shareReplay() | |
var subscription = source.subscribe(function (x) {console.log('Next: ',x);},function (err) {console.log('Error: ' ,err);},function () {console.log('Completed');}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment