-
Notifications
You must be signed in to change notification settings - Fork 108
Open
Description
题目
const timeout = i =>
new Promise(resolve => {
console.log(i);
setTimeout(() => resolve(i), i);
});
const data = Date.now();
function asyncPool(list, callback, limit) {
// ...
}
asyncPool([1000, 5000, 3000, 2000], timeout, 2).then(results => {
console.log(results); // [ 1000, 5000, 3000, 2000 ]
console.log(Date.now() - data); //6018
});Metadata
Metadata
Assignees
Labels
No labels