genny
genny copied to clipboard
Could add api : fork(), join() like suspend?
suspend(function*() {
var fileNames = yield fs.readdir('test', suspend.resume());
fileNames.forEach(function(fileName) {
fs.readFile('test/' + fileName, 'utf8', suspend.fork());
});
var files = yield suspend.join();
})();
the fork() and join() are helpful. Although the "yield resume" close but need to iterate twice