Last active
January 9, 2019 21:41
-
-
Save thejohnfreeman/472bc0503eb35dc0ed34dcde65504404 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
function flow(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) | |
generator.next = action(generator.next) | |
generator.throw = action(generator.throw) | |
generator.return = action(generator.return) | |
return new GeneratorSubscriber(observer, generator) | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment