调用一个方法继续之前的等待
export function collectWatchFn(callBack) { let status = ''; let arrFn = []; if (status === 'ing') { return; } return function (...args) { return new Promise(async (resolve, reject) => { if (status === 'ing') { //@ts-ignore arrFn.push((flag) => { if (flag) { resolve(true); } }); return; } status = 'ing'; //@ts-ignore await callBack.call(this, ...args); status = ''; if (arrFn.length) { arrFn.forEach((item) => { //@ts-ignore item(true); }); arrFn = []; } else { resolve(true); } }); }; }