Created
June 22, 2016 00:12
-
-
Save deontologician/028f23f1acfc3fca3800fcfff5f6b204 to your computer and use it in GitHub Desktop.
Some rxjs 5 lift magic
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
// Before you'd do something like: | |
var obs = Observable.create((subscriber) => { | |
some.other().observable().chain().subscribe({ | |
next(x){ subscriber.next(x) }, | |
error(e){ subscriber.error(e) }, | |
complete(){ subscriber.complete() }, | |
}) | |
}) | |
// in rxjs 5 you can do | |
var obs = some.other().observable().chain().lift((subscriber, src) => { | |
src.subscribe({ | |
next(x) { subscriber.next() }, | |
error(e) { subscriber.error(e) }, | |
complete() { subscriber.complete() }, | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment