如果在Promise.all之后向数组添加promise - 它将被忽略
let pr = [];
let start = Date.now();
pr.push(new Promise((resolve) => {
setTimeout(() => {
resolve();
}, 2000);
}));
Promise.all(pr).then(() => {
console.log('All done' + (Date.now() - start));
});
pr.push(new Promise((resolve) => {
setTimeout(() => {
resolve();
}, 4000);
}));
所有done2000
我该怎么做?