The array of promises or promise-returning functions to execute. 要执行的promise数组或返回promise的函数数组
(optional) The maximum number of promises to execute in parallel. Defaults to infinity. 最大并发数,默认为无穷大
A Promise that resolves with an array of promise settlement results. 一个Promise,它解析为一个包含每个promise解析状态和值的数组
const promises = [Promise.resolve(1), Promise.resolve(2), Promise.reject('error')]
const result = await promiseParallelSettled(promises, 2) // maximum concurrency of 2 - 最大并发数为2
console.log(result) // [{ status: 'fulfilled', value: 1 }, { status: 'fulfilled', value: 2 }, { status: 'rejected', reason: 'error' }]
Creates a promise that is resolved with an array of promise settlement results, in the same order as the input promises array. The returned promise will be fulfilled when all of the input promises have settled, either fulfilled or rejected.
创建一个以输入 promise 数组的结果数组解决的 promise, 按照输入 promise 数组的相同顺序。 当所有输入 promise 都已解决时,返回的 promise将被实现, 要么实现,要么拒绝。