16 lines · 431 B · TypeScript
RawDownload
/** * Runs asynchronous operations in call order while keeping the queue usable * after an individual operation rejects. */export class SerializedAsyncQueue {  private tail: Promise<void> = Promise.resolve();   run<T>(operation: () => Promise<T>): Promise<T> {    const result = this.tail.then(operation, operation);    this.tail = result.then(      () => undefined,      () => undefined,    );    return result;  }}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t