async_retry.ts

TypeScriptエキスパート

Explorer

C40
C++40
C#40
Dart40
Go40
Java40
JavaScript40
Kotlin40
Objective-C40
Perl40
PHP40
Python40
R40
Ruby40
Rust40
Shell40
Swift40
TypeScript
初級10
中級10
上級10
エキスパート5
event_emitter.ts
async_retry.ts
builder_pattern.ts
type_validator.ts
generic_cache.ts
マスター5
async_retry.ts
Click to focus
1
2
3
4
5
6
7
8
async function retry<T>(fn: () => Promise<T>, times = 3): Promise<T> {
   try {
       return await fn();
   } catch (e) {
       if (times <= 1) throw e;
       return retry(fn, times - 1);
   }
}
0WPM0%0:000/197(0%)|Ln 1, Col 1
UTF-8TypeScript

関連する練習問題