An extremely intuitive, small, and fast functional reactive stream library for JavaScript
dependabot[bot] on npm_and_yarn
staltz on master
chore(deps): bump elliptic from… (compare)
dependabot[bot] on npm_and_yarn
chore(deps): bump elliptic from… (compare)
staltz on npm_and_yarn
staltz on master
chore(deps): bump cached-path-r… (compare)
--
is constant time between the diff events
this example works as expected
const xs = xstream.Stream
var stream = xs.periodic(1000).take(3)
xs.merge(stream, stream.take(1))
.addListener({
next: i => console.log(i),
error: err => console.error(err),
complete: () => console.log('completed'),
})
Output:
0
0
1
2
"completed"
var stream = xs.periodic(1000).take(3).debug('test')
"test:"
0
0
0
"test:"
1
1
"test:"
2
2
"completed"
it's console prints
"test:"
0
instead of
test: 0
I think the Marble diagram is bit misleading.
* In essence, `flattenSequentially` concatenates all nested streams.
*
* Marble diagram:
*
* ```text
* --+--------+-------------------------
* \ \
* \ ----1----2---3--|
* --a--b----c----d--|
* flattenSequentially
* -----a--b----c----d------1----2---3--
*
```
* --+--------+-------------------------
* \ \
* \ ----1----2---3--|
* --a--b----c----d--|
* flattenSequentially
* -----a--b----c----d--1-2-3-----
flattenConcurrently
with some extra logic to delay events from streams that are emitted before the first one finishes
stream$.mapTo(generateId())
?
λ cat > test.js
const xs = require('xstream').default;
xs.of(1, 2, 3).mapTo(Math.random()).addListener({next: console.log})
λ npx -p xstream@10 node test.js
npx: installed 2 in 2.063s
0.5104117713843652
0.5104117713843652
0.5104117713843652
λ npx -p xstream@11 node test.js
npx: installed 2 in 2.463s
0.07187050076072277
0.07187050076072277
0.07187050076072277