Spaces:
Running on Zero
Running on Zero
Download frontend/src/explorer/model-load-queue.ts from fffiloni/idol-commons: direct link, hf CLI and curl.
- Browser
- Download file 408 Bytes
-
https://huggingface.co/spaces/fffiloni/idol-commons/resolve/main/frontend/src/explorer/model-load-queue.ts
- Command line
-
hf download hf://spaces/fffiloni/idol-commons/frontend/src/explorer/model-load-queue.ts
-
curl -L -o model-load-queue.ts https://huggingface.co/spaces/fffiloni/idol-commons/resolve/main/frontend/src/explorer/model-load-queue.ts
408 Bytes
| // GLTF parsing cannot be aborted midway. Let an obsolete parse finish and release | |
| // its resources before starting another download/decoder, instead of overlapping. | |
| let tail:Promise<unknown>=Promise.resolve(); | |
| export function queueModelLoad<T>(signal:AbortSignal,task:()=>Promise<T>):Promise<T>{ | |
| const run=tail.then(()=>{signal.throwIfAborted();return task();}); | |
| tail=run.catch(()=>{}); | |
| return run; | |
| } | |