Created
November 1, 2019 13:16
-
-
Save FbN/eb12809df533f33aa53191084a24804a to your computer and use it in GitHub Desktop.
Most/Core Version
This file contains hidden or 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 todoList (deferred) { | |
const ping$ = fromArray([...Array(config.iterations).keys()]) | |
const todo$ = multicast(map(todo, ping$)) | |
const old$ = merge( | |
map(todo => (todo.id % 4 === 0 ? todo : {}), take(1, todo$)), | |
filter(todo => todo.id % 4 === 0, skip(1, todo$)) | |
) | |
const sample$ = snapshot( | |
(old, last) => ({...last, old}), | |
old$, | |
todo$ | |
) | |
const list$ = scan((list, item) => [...list, item], [], sample$) | |
const end$ = take( | |
1, | |
filter(list => list.length === config.iterations, list$) | |
) | |
return tap(res => deferred.resolve(res), end$) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment