json-crdt-server
Version:
JSON CRDT server and syncing local-first browser client
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 {};