fix #98
This commit is contained in:
1 parent
9837ef4f36
commit
330b086b8b
18 files changed
+119
-114
No files matched your search
@@ -14,7 +14,7 @@ export function sleep(ms: number): Promise<void> {
|
||||
|
||||
export function PromiseTimer<T>(promise: Promise<T>, ms: number): Promise<T> {
|
||||
const timeoutPromise = new Promise<T>((_, reject) =>
|
||||
setTimeout(() => reject(new Error("PromiseTimer: Operation timed out")), ms)
|
||||
setTimeout(() => reject(new Error('PromiseTimer: Operation timed out')), ms)
|
||||
);
|
||||
return Promise.race([promise, timeoutPromise]);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user