Creates a callbag source that emits given values immediately.
1linkfunction of<T>(...args: T[]): Source<T>
1linkimport { of, subscribe, pipe } from 'callbag-common';
2link
3linkconst source = of(1, 2, 3, 4);
4linkpipe(source, subscribe(console.log));
1
2
3
4
👉 of()
is mostly used for converting static values to callbag sources:
1link// --> this function expects a callbag as its argument
2linkexport function myFunc(callbagArg: Callbag<any, any>) {
3link ...
4link}
1linkimport { of } from 'callbag-common';
2link
3linkmyFunc(of(42)); // --> run the function with a static value by converting it