@jsonjoy.com/reactive-rpc
Version:
Reactive-RPC is a library for building reactive APIs over WebSocket, HTTP, and other RPCs.
13 lines (12 loc) • 446 B
TypeScript
import { Defer } from 'thingies/lib/Defer';
declare class Entry<T> {
readonly code: () => Promise<T>;
readonly future: Defer<T>;
constructor(code: () => Promise<T>, future: Defer<T>);
}
export declare class Mutex {
protected readonly queue: Map<string, Entry<unknown>[]>;
readonly acquire: <T>(key: string, code: () => Promise<T>) => Promise<T>;
protected run<T>(key: string, entry: Entry<T>): Promise<void>;
}
export {};