Created
November 9, 2016 19:29
-
-
Save Alex0007/a58171df07da4ffca2abd0d01e70f001 to your computer and use it in GitHub Desktop.
flattenSequentially problem
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
const xs = require('xstream').default | |
const flattenSequentially = require('xstream/extra/flattenSequentially').default | |
const createTestObservable = item => { | |
return xs.create({ | |
start: function(listener) { | |
setTimeout(() => { | |
listener.next(item) | |
listener.complete() | |
}, 1000) | |
}, | |
stop: () => {} | |
}) | |
} | |
xs.fromArray([1, 2]) | |
.map(createTestObservable) | |
.compose(flattenSequentially) | |
.subscribe({ | |
next: console.log, | |
error: console.error | |
}) | |
xs.fromArray([3]) | |
.map(createTestObservable) | |
.compose(flattenSequentially) | |
.subscribe({ | |
next: console.log, | |
error: console.error | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment