Skip to content

Instantly share code, notes, and snippets.

@Alex0007
Created November 9, 2016 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Alex0007/a58171df07da4ffca2abd0d01e70f001 to your computer and use it in GitHub Desktop.
Save Alex0007/a58171df07da4ffca2abd0d01e70f001 to your computer and use it in GitHub Desktop.
flattenSequentially problem
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