ES6 Generators Deliver Go Style Concurrency in JavaScript
swannodette.github.io
swannodette.github.io
console.log('this is in the document');
go(function() { console.log('this is in a web worker'); });
I'd recommend against it. Even if you can toString() the function passed to go() and load that into a worker, you'd not carry the function's closure, which I think is too complex. var x = 5;
go(function() { console.log('x = '+x); });
// => x = undefined
Could be done, but I'd rather stick with paradigms that fit the language more closely.