Skip to content

Instantly share code, notes, and snippets.

@willconant
Created November 8, 2011 23:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willconant/1349764 to your computer and use it in GitHub Desktop.
Save willconant/1349764 to your computer and use it in GitHub Desktop.
Tim Caswell's Fiber idea prototyped with Marcel Laverdet's node-fibers
require('fibers');
module.exports = function(fn) {
Fiber(function() {
var fiber = Fiber.current;
var wait = yield;
var resume = function() {
fiber.run(arguments);
};
fn(resume, wait);
}).run();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment