Skip to content

Instantly share code, notes, and snippets.

@mattpodwysocki
Created June 17, 2013 22:26
Show Gist options
  • Save mattpodwysocki/5801055 to your computer and use it in GitHub Desktop.
Save mattpodwysocki/5801055 to your computer and use it in GitHub Desktop.
o.toObservable = function () {
var o = this;
return Rx.Observable.create(function (obs) {
function handler (e) {
obs.onNext(e);
}
Object.observe(o, handler);
return function () {
Object.unobserve(o, handler);
}
}
}
o.toObservable().select(function (x) { return x.newValue + x.oldValue; });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment