1
0
mirror of https://github.com/ruanyf/es6tutorial.git synced 2025-06-10 07:58:19 +00:00

修改generator

This commit is contained in:
Ruan Yifeng 2015-02-16 18:47:46 +08:00
parent 4ee9fa07d9
commit caacc57d9f

@ -755,7 +755,10 @@ scheduler(longRunningTask());
function scheduler(task) {
setTimeout(function() {
if (!task.next(task.value).done) {
var taskObj = task.next(task.value);
// 如果Generator函数未结束就继续调用
if (!taskObj.done) {
task.value = taskObj.value
scheduler(task);
}
}, 0);