1.0.2 • Published 4 years ago
@gedalos.dev/callbag-subject v1.0.2
callbag-subject
Callbag sink/source.
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-subject
using from nodejs
import subject from '@gedalos.dev/callbag-subject';
import pipe from '@gedalos.dev/callbag-pipe';
import of from '@gedalos.dev/callbag-of';
import forEach from '@gedalos.dev/callbag-for-each';
const source = subject();
pipe(
source,
forEach(console.log) // 1, 2, 3, 5, 8, 13, 21
);
source(DATA)(1);
source(DATA)(2);
source(DATA)(3);
source(DATA)(5);
source(DATA)(8);
source(DATA)(13);
source(DATA)(21);
using from browser
import subject from 'callbag-subject/index.js';
import pipe from 'callbag-pipe/index.js';
import of from 'callbag-of/index.js';
import forEach from 'callbag-for-each/index.js';
const source = subject();
pipe(
source,
forEach(console.log) // 1, 2, 3, 5, 8, 13, 21
);
source(DATA)(1);
source(DATA)(2);
source(DATA)(3);
source(DATA)(5);
source(DATA)(8);
source(DATA)(13);
source(DATA)(21);