如何同步一系列承诺?
Promise.all([...])
sequence
function sequence(arr) { return new Promise(function (resolve, reject) { // try resolving all elements in 'arr', // but strictly one after another; });}
编辑
sequence
function sequence(nextPromise) { // while nextPromise() creates and returns another promise, // continue resolving it;}
解
万千封印
Smart猫小萌
相关分类