| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9b25268 commit 0a85b0f
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -569,9 +569,17 @@ primordials.SafePromiseAllSettled = (promises, mapFn) => | |||
| 569 | 569 | * @param {(v: T|PromiseLike<T>, k: number) => U|PromiseLike<U>} [mapFn] | |
| 570 | 570 | * @returns {Promise<void>} | |
| 571 | 571 | */ | |
| 572 | - primordials.SafePromiseAllSettledReturnVoid = async (promises, mapFn) => { | ||
| 573 | - await primordials.SafePromiseAllSettled(promises, mapFn); | ||
| 574 | - }; | ||
| 572 | + primordials.SafePromiseAllSettledReturnVoid = (promises, mapFn) => new Promise((resolve) => { | ||
| 573 | + let pendingPromises = promises.length; | ||
| 574 | + if (pendingPromises === 0) resolve(); | ||
| 575 | + const onSettle = () => { | ||
| 576 | + if (--pendingPromises === 0) resolve(); | ||
| 577 | + }; | ||
| 578 | + for (let i = 0; i < promises.length; i++) { | ||
| 579 | + const promise = mapFn != null ? mapFn(promises[i], i) : promises[i]; | ||
| 580 | + PromisePrototypeThen(PromiseResolve(promise), onSettle, onSettle); | ||
| 581 | + } | ||
| 582 | + }); | ||
| 575 | 583 | ||
| 576 | 584 | /** | |
| 577 | 585 | * @template T,U | |
| Back | FazBrowse Home | New Git URL |
0 commit comments