You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
functionco(gen){varctx=thisreturnnewPromise(function(resolve,reject){if(typeofgen==='function')gen=gen.call(ctx)if(!gen||typeofgen.next!=='function')returnresolve(gen)onFulfilled()functiononFulfilled(res){varrettry{ret=gen.next(res)}catch(e){returnreject(e)}next(ret)}functiononRejected(err){varrettry{ret=gen.throw(err)}catch(e){returnreject(e)}next(ret)}functionnext(ret){if(ret.done)returnresolve(ret.value);varvalue=toPromise.call(ctx,ret.value);//var value = ret.valueif(value&&isPromise(value))returnvalue.then(onFulfilled,onRejected);returnonRejected(newTypeError('You may only yield a function, promise, generator, array, or object, '+'but the following object was passed: "'+String(ret.value)+'"'));}})}functionisPromise(obj){return'function'==typeofobj.then}
The text was updated successfully, but these errors were encountered:
基于 thunk 的自动执行
基于 Promise 的自动执行
co 模块
The text was updated successfully, but these errors were encountered: