Saisie de Code · TypeScript
Async Pool
Run async tasks with bounded concurrency.
Difficulte: Avance · 18 Lignes · Licence: public-domain
async function asyncPool<T, R>(
items: readonly T[],
concurrency: number,
fn: (item: T) => Promise<R>
): Promise<R[]> {
const results: R[] = [];
const executing = new Set<Promise<void>>();
for (const item of items) {
const p = fn(item).then((r) => { results.push(r); });
Temps0:00
Vitesse (WPM)0.0
Précision100.0%
Erreurs0
Clavier Live
Touche Suivante: A | Dernière Touche: -
Progression: 0.0%
@
&
É
"
'
(
§
È
!
Ç
À
)
-
A
Z
E
R
T
Y
U
I
O
P
^
$
Q
S
D
F
G
H
J
K
L
M
Ù
W
X
C
V
B
N
,
;
:
=
Espace
Timed Test Leaderboard
Aucun resultat pour le moment.