Created
January 6, 2018 04:03
-
-
Save amit777/203950ad016f0cf577f311eb9307501e to your computer and use it in GitHub Desktop.
RxJS Observer outside of Observable.create
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
var Rx = require('rxjs'); | |
var source; | |
var timeline = Rx.Observable.create(function(observer){ | |
var to; | |
var last = null; | |
source = observer; | |
return function() { | |
console.log('observer ended '); | |
}; | |
}); | |
setTimeout(function(){ | |
source.next('First data'); | |
setTimeout(function(){ | |
source.next('Second data'); | |
source.complete(); | |
}, 500); | |
}, 100); | |
timeline.subscribe(function(d){ | |
console.log('subscribe '+d); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment