Open Yang03 opened 8 years ago
const gen = function() * {
const f1 = yield readFile('fileA');
const f2 = yield readFile('fileB');
}
function run(fn) {
const ge = fn()
function next() {
const result = ge.next(data)
if(result.done) return
result.value(next)
}
next()
}
thunk
thunk 是‘传名调用’的一种策略.
javascript的thunk函数
看看tj大神的thunkify