UNPKG

324 BJavaScriptView Raw
1
2import channels from '../lib/index'
3import t from 'transducers-js'
4
5var { go, chan, take, put, sleep, buffers, pipe } = channels
6
7var allowEven = t.filter((n) => n % 2 === 0)
8var ch = chan(2, allowEven)
9
10go(async function() {
11 console.log(await take(ch))
12 console.log(await take(ch))
13})
14
15put(ch, 1)
16put(ch, 2)
17put(ch, 3)