Skip to content

Instantly share code, notes, and snippets.

@deontologician
Created June 22, 2016 00:12
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 deontologician/028f23f1acfc3fca3800fcfff5f6b204 to your computer and use it in GitHub Desktop.
Save deontologician/028f23f1acfc3fca3800fcfff5f6b204 to your computer and use it in GitHub Desktop.
Some rxjs 5 lift magic
// 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