Skip to content

Instantly share code, notes, and snippets.

@thejohnfreeman
Last active January 9, 2019 20:47
Show Gist options
  • Save thejohnfreeman/40f90d533ec2f097c3545ba0d138380b to your computer and use it in GitHub Desktop.
Save thejohnfreeman/40f90d533ec2f097c3545ba0d138380b to your computer and use it in GitHub Desktop.
function async(makeGenerator) {
// Return a function that constructs an Observable.
return function(...args) {
return Observable.create(observer => {
// This function won't be called until the observable is subscribed.
const generator = makeGenerator.apply(this, args)
return new GeneratorSubscriber(observer, generator)
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment