1.0.2 • Published 4 years ago
@gedalos.dev/callbag-sample v1.0.2
callbag-sample
When pullable source emits data, then values from listenable source are emited.
original idea by André Staltz - callbag
run test
$ yarn
$ yarn -s test
the status code ($?
) will be 0 or 1 depending on the result.
install
$ yarn add @gedalos.dev/callbag-sample
example
import pipe from '@gedalos.dev/callbag-pipe';
import interval from '@gedalos.dev/callbag-interval';
import of from '@gedalos.dev/callbag-of';
import sample from '@gedalos.dev/callbag-sample';
import forEach from '@gedalos.dev/callbag-for-each';
pipe(
interval(1000), // 0---1---2---3---4---5---6-->
sample(of('alfa', 'beta', 'gamma')), // a---b---c------------------>
forEach(console.log) // a---b---c------------------>
);