Skip to content

Instantly share code, notes, and snippets.

@ORESoftware
Created December 18, 2016 21:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ORESoftware/677ad0a3adf41c04a60829921ba4c4c4 to your computer and use it in GitHub Desktop.
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
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