Skip to content

Instantly share code, notes, and snippets.

@rfaisal
Last active January 9, 2016 08:32
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 rfaisal/dd4e01f62f1052eb9443 to your computer and use it in GitHub Desktop.
Save rfaisal/dd4e01f62f1052eb9443 to your computer and use it in GitHub Desktop.
var a = Rx.Observable.create(function(observer) {
setInterval(function() {
var curA = Math.floor((Math.random() * 100) + 1);
console.log("Current value of a " + curA);
observer.onNext(curA);
}, 3000);
});
var b = 0;
a.subscribe(function(val) {
b=val+1;
console.log("Current value of b " +b);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment