This commit is contained in:
手瓜一十雪 committed 2024-07-29 09:10:52 +08:00
1 parent 9837ef4f36
commit 330b086b8b
18 files changed
+119 -114

No files matched your search

+1 -1
View File
@@ -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]);
}