Created
July 17, 2015 02:14
-
-
Save yelouafi/8cea6952db587673de0b 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
Stream.prototype.takeUntil = function(untilP) { | |
... | |
// isFuture | |
Stream.Future( | |
Promise.race([ | |
untilP.then( _ => () => Stream.Empty, Stream.Abort ), | |
this.promise.then( s => () => s.takeUntil(promise), Stream.Abort ) | |
]).then( lazy => lazy())) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
shouldn't the second element in
Promise.race
array be...s => () => s.takeUntil(untilP),
instead of...s => () => s.takeUntil(promise)
?