https://github.com/andarist/callbag-defer
👜 Callbag which creates a source from a given factory when sink subscribes.
https://github.com/andarist/callbag-defer
callbag callbags
Last synced: about 1 month ago
JSON representation
👜 Callbag which creates a source from a given factory when sink subscribes.
- Host: GitHub
- URL: https://github.com/andarist/callbag-defer
- Owner: Andarist
- Created: 2018-11-10T22:24:27.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-10T11:19:50.000Z (over 6 years ago)
- Last Synced: 2025-08-09T02:50:08.322Z (about 2 months ago)
- Topics: callbag, callbags
- Language: JavaScript
- Homepage:
- Size: 4.88 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# callbag-defer
Callbag which creates a source from a given factory when sink subscribes.
## Example
```js
import defer from 'callbag-defer'
import forEach from 'callbag-for-each'
import fromEvent from 'callbag-from-event'
import interval from 'callbag-interval'
import pipe from 'callbag-pipe'pipe(
defer(() =>
Math.random() > 0.5 ? fromEvent(document, 'click') : interval(1000),
),
forEach(value => {
// value being either click event or a number
}),
)
```