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