The best way to control Claude Code, Codex and more from any computer or phone

main
ts 12 lines 304 Bytes
Raw
1 export class SerializedAsyncQueue {
2 private tail: Promise<void> = Promise.resolve();
3
4 run<T>(operation: () => Promise<T>): Promise<T> {
5 const result = this.tail.then(operation, operation);
6 this.tail = result.then(
7 () => undefined,
8 () => undefined,
9 );
10 return result;
11 }
12 }