Download extension/src/serial.ts from Gaurav711/HyperFlow: direct link, hf CLI and curl.
- Browser
- Download file 437 Bytes
-
https://huggingface.co/spaces/Gaurav711/HyperFlow/resolve/main/extension/src/serial.ts
- Command line
-
hf download hf://spaces/Gaurav711/HyperFlow/extension/src/serial.ts
-
curl -L -o serial.ts https://huggingface.co/spaces/Gaurav711/HyperFlow/resolve/main/extension/src/serial.ts
437 Bytes
| /** Returns a runner that executes async tasks strictly one after another, so read-modify-write | |
| * sequences on extension storage cannot interleave. A failed task does not block later ones. */ | |
| export function serialize() { | |
| let tail: Promise<unknown> = Promise.resolve(); | |
| return <T>(task: () => Promise<T>): Promise<T> => { | |
| const result = tail.then(task, task); | |
| tail = result.catch(() => undefined); | |
| return result; | |
| }; | |
| } | |