Created
December 18, 2016 21:58
-
-
Save ORESoftware/677ad0a3adf41c04a60829921ba4c4c4 to your computer and use it in GitHub Desktop.
Trying to make an observable array "stay open" so that future values in the array will be seen
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 Rx = require('rx-lite'); | |
const values = [1, 2, 3]; | |
const obs = Rx.Observable.from(values); | |
obs.subscribe( | |
function onNext(result) { | |
console.log('item =>', result); | |
}, | |
function onError(e) { | |
console.error(e.stack || e); | |
}, | |
function onCompleted() { | |
console.log('observable is completed'); | |
} | |
); | |
setTimeout(function () { | |
values.push(4); | |
values.push(5); | |
values.push(6); | |
}, 3000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment