Skip to content

Instantly share code, notes, and snippets.

@DooVDe
Created June 1, 2016 10:18
Show Gist options
  • Save DooVDe/44b7166befc8f3704e15506854826cd9 to your computer and use it in GitHub Desktop.
Save DooVDe/44b7166befc8f3704e15506854826cd9 to your computer and use it in GitHub Desktop.
function getStreamWrapper() {
function getStream(pool) {
return Kefir
.sequentially(1000, [1, 2, 3])
.onEnd(function(){
pool.plug(getStream(pool));
});
}
var pool = Kefir.pool();
getStream(pool);
pool.plug(stream);
return pool;
}
getStreamWrapper().log()
function getStream () {
var stream = Kefir.sequentially(0, [1, 2, 3]);
var end = stream
.last()
.flatMapLatest(getStream);
return stream.merge(end);
}
getStream().log();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment