Go
Overview
import { makeChannel } from 'csp-coffee/channel';
import { go } from 'csp-coffee/go';
import { take, putAsync } from 'csp-coffee/operators';
const ch = makeChannel();
function* helloWorldRoutine () {
const greeting: string = yield take(ch);
console.log(greeting);
}
const { cancellablePromise } = go(helloWorldRoutine)
cancellablePromise.then(() => {
console.log('DONE!');
})
putAsync(ch, 'Hello World!');
// Will print "Hello Roman!"Yielding magic
Passing paratemers to our routine
Channel from routine
Last updated