Created
October 9, 2015 07:11
-
-
Save avnersorek/ee6e97778bf6502770d7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {go, chan, take, put} from 'js-csp'; | |
let channel = chan(); | |
go(function* () { | |
const text = yield take(ch); | |
console.log('A > RECEIVED:', text); | |
}); | |
go(function* () { | |
const text = yield take(ch); | |
console.log('B > RECEIVED:', text); | |
}); | |
go(function* () { | |
const text = 'dog' | |
console.log('C > SENDING:', text); | |
yield put(ch, text); | |
}); | |
// terminal output: | |
// | |
// => C > SENDING: dog | |
// => A > RECEIVED: dog |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment