Skip to content

Instantly share code, notes, and snippets.

@Raynos Raynos/x.js Secret
Created Aug 6, 2013

Embed
What would you like to do?
var main = suspend(function* (resume) {
var c1 = yield http.get('http://gist.github.com/isaacs/6143332',
resume.raw())
var c2 = yield http.get('http://gist.github.com/isaacs/6093040',
resume.raw());
// Get the stream - its the first argument
var s1 = c1[0], s2 = c2[0];
var ready, select = selector([s1, s2]);
var finished = 0;
while (ready = yield select(resume)) {
var which = ready == s1 ? 's1':'s2';
var data = ready.read();
var file = yield fs.readFile(data, resume)
console.log(which, data && data.length, file);
if (!data)
if (++finished < 2) continue;
else break;
}
console.log("All done!");
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.