Created
January 15, 2015 21:55
-
-
Save mattpodwysocki/45fcfd134d3c7126e98f to your computer and use it in GitHub Desktop.
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
// Using anon functions | |
var source = self; | |
return new AnonymousObservable(function (o) { | |
return source.subscribe( | |
function (x) { o.onNext(x); }, | |
function (e) { o.onError(e); }, | |
function () { o.onCompleted(); }) | |
}); | |
// Using binders | |
function bindOnNext(o) { | |
return function (x) { o.onNext(x); }; | |
} | |
function bindOnError(o) { | |
return function (e) { o.onError(e); }; | |
} | |
function bindOnCompleted(o) { | |
return function () { o.onCompleted(); }; | |
} | |
// Using anon functions | |
var source = self; | |
return new AnonymousObservable(function (o) { | |
return source.subscribe( | |
bindOnNext(o), | |
bindOnError(o), | |
bindOnCompleted(o)) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment