You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import xs from 'xstream'
// TEST FROM xs.of()
const a = xs.of(' -a- ').debug(' -a- ')
const b = a.map(v => v + ' -b- ').debug(' -b- ')
const c = a.map(v => v + ' -c- ').debug(' -c- ')
const d = xs
.merge(b, c)
.map(v => v + ' -d- ')
.debug(' -d- ')
d.addListener({
next: () => {},
error: () => {},
complete: () => {}
})
// SAME CODE BUT WITH xs.fromPromise()
const a2 = xs.fromPromise(Promise.resolve(' -a- ')).debug(' -a2- ')
const b2 = a2.map(v => v + ' -b2- ').debug(' -b2- ')
const c2 = a2.map(v => v + ' -c2- ').debug(' -c2- ')
const d2 = xs
.merge(b2, c2)
.map(v => v + ' -d2- ')
.debug(' -d2- ')
d2.addListener({
next: () => {},
error: () => {},
complete: () => {}
})
The debug output is like a-b-d-a-c-d a2-b2-d2-c2-d2
Why when create the stream from promise the first debug is printed only one time at the beginning and when create it with .of() from const value the debug 'a' is printed two time?
Let's try this code.
The debug output is like
a-b-d-a-c-d
a2-b2-d2-c2-d2
Why when create the stream from promise the first debug is printed only one time at the beginning and when create it with .of() from const value the debug 'a' is printed two time?
P.S. Related stack overflow question
The text was updated successfully, but these errors were encountered: