@uwdata/mosaic-core
Version:
Scalable and extensible linked data views.
36 lines • 1.05 kB
TypeScript
/**
* Synchronizer class to aid synchronization of updates on multiple pending operations.
*/
export declare class Synchronizer<T = unknown> {
private _set;
private _done;
private _promise;
/**
* Create a new synchronizer instance.
*/
constructor();
/**
* Mark an item as pending.
* @param item An item to synchronize on.
*/
pending(item: T): void;
/**
* Mark a pending item as ready, indicating it is
* ready for a synchronized update.
* @param item An item to synchronize on.
* @returns True if the synchronizer is ready to
* resolve, false otherwise.
*/
ready(item: T): boolean;
/**
* Resolve the current synchronization cycle, causing the synchronize
* promise to resolve and thereby trigger downstream updates.
*/
resolve(): void;
/**
* The promise for the current synchronization cycle.
* @returns The synchronization promise.
*/
get promise(): Promise<void>;
}
//# sourceMappingURL=synchronizer.d.ts.map