Skip to content

Instantly share code, notes, and snippets.

@willconant
Created November 14, 2011 17:23
Show Gist options
  • Save willconant/1364503 to your computer and use it in GitHub Desktop.
Save willconant/1364503 to your computer and use it in GitHub Desktop.
Tim Caswell's Fiber idea implemented with Mozilla Javascript 1.7 generators
/* in this case, there is no explicit wait() function, instead, fiberized functions use the yield keyword */
module.exports = function(generatorFunction) {
var iterator;
function resume() {
iterator.send(arguments);
}
iterator = generatorFunction(resume);
iterator.next();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment