Spaces:
Running
Running
Download webui/js/timeout.js from Leon4gr45/openoperator: direct link, hf CLI and curl.
- Browser
- Download file 641 Bytes
-
https://huggingface.co/spaces/Leon4gr45/openoperator/resolve/main/webui/js/timeout.js
- Command line
-
hf download hf://spaces/Leon4gr45/openoperator/webui/js/timeout.js
-
curl -L -o timeout.js https://huggingface.co/spaces/Leon4gr45/openoperator/resolve/main/webui/js/timeout.js
641 Bytes
| // function timeout(ms: number, errorMessage: string = "Operation timed out") { | |
| // let timeoutId: number; | |
| // const promise = new Promise<never>((_, reject) => { | |
| // timeoutId = setTimeout(() => { | |
| // reject(new Error(errorMessage)); | |
| // }, ms); | |
| // }); | |
| // return { promise, cancel: () => clearTimeout(timeoutId) }; | |
| // } | |
| // export async function Timeout<T>(promise: Promise<T>, ms: number): Promise<T> { | |
| // const { promise: timeoutPromise, cancel: cancelTimeout } = timeout(ms); | |
| // // Race the timeout against the original promise | |
| // return await Promise.race([promise, timeoutPromise]).finally(cancelTimeout); | |
| // } | |