最近比较忙,有时间完善思路。
关键代码
export function promiseQueue(executors: any[]) {
return new Promise((resolve, reject) => {
if (!Array.isArray(executors)) { executors = Array.from(executors); }
if (executors.length <= 0) { return resolve([]); }
const res: any[] = [];
executors = executors.map((x, i) => () => {
const p = typeof x === 'function'