-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue with takeUntil in nested stream
This issue was caused by #180 which made sure that nested streams were updated properly. Updating them properly caused nested takeUntil'd streams to end too soon.
- Loading branch information
Einar Norðfjörð
committed
Oct 5, 2018
1 parent
48799a9
commit 4b0340c
Showing
4 changed files
with
257 additions
and
5 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
var flyd = require('../../lib'); | ||
var takeUntil = require('../takeuntil'); | ||
var drop = require('ramda/src/drop'); | ||
|
||
var dropCurrentValue = flyd.transduce(drop(1)); | ||
|
||
module.exports = function(s) { | ||
return flyd.combine(function(stream$, self) { | ||
var value$ = stream$(); | ||
flyd.on(self, takeUntil(value$, dropCurrentValue(stream$))); | ||
flyd.on(self, takeUntil(value$, stream$)); | ||
}, [s]); | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
var flyd = require('../../lib'); | ||
var drop = require('ramda/src/drop'); | ||
|
||
var dropCurrentValue = flyd.transduce(drop(1)); | ||
|
||
module.exports = flyd.curryN(2, function(src, term) { | ||
return flyd.endsOn(flyd.merge(term, src.end), flyd.combine(function(src, self) { | ||
var end$ = term.hasVal ? dropCurrentValue(term) : term; | ||
return flyd.endsOn(flyd.merge(end$, src.end), flyd.combine(function(src, self) { | ||
self(src()); | ||
}, [src])); | ||
}); |
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