UNPKG
csp
Version:
latest (0.0.1-alpha1)
0.0.1-alpha1
Communicating sequential processes for node. Go style concurrency with channels.
olahol/node-csp
csp
/
examples
/
buffered.js
12 lines
(8 loc)
•
217 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
var
csp =
require
(
".."
);
var
chan1 =
new
csp.
Chan
(
2
); csp.
spawn
(
function
* () {
yield
chan1.
put
(
"buffered"
);
yield
chan1.
put
(
"channel"
);
console
.
log
(
yield
chan1.
take
());
console
.
log
(
yield
chan1.
take
()); });