Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/staltz/callbag-sample
👜 Callbag operator that samples a pullable when a listenable emits
https://github.com/staltz/callbag-sample
Last synced: 28 days ago
JSON representation
👜 Callbag operator that samples a pullable when a listenable emits
- Host: GitHub
- URL: https://github.com/staltz/callbag-sample
- Owner: staltz
- License: mit
- Created: 2018-02-04T10:17:50.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-04-20T12:29:00.000Z (over 1 year ago)
- Last Synced: 2024-10-10T00:49:05.626Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 19.5 KB
- Stars: 5
- Watchers: 3
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
- awesome-callbags - sample
README
# callbag-sample
Callbag operator that samples a value from the pullable source only when a listenable source emits, and returns a listenable source.
`npm install callbag-sample`
## example
Sample the next character from a string, every second:
```js
const fromIter = require('callbag-from-iter');
const interval = require('callbag-interval');
const forEach = require('callbag-for-each');
const sample = require('callbag-sample');const source = sample(fromIter('hello'))(interval(1000));
forEach(x => console.log(x))(source); // h
// e
// l
// l
// o
```