rc-js-util
Version:
A collection of TS and C++ utilities to help writing performant and correct applications, achieved through strict typing and (removable) invariant checking.
53 lines • 1.53 kB
TypeScript
/**
* @public
* A provider that should return an iterator that represents a sequence of update operations. Useful for breaking up
* operations that would block the UI for an unacceptably long time.
*/
export interface IIncrementallyUpdatable {
incrementallyUpdate(): IterableIterator<void>;
}
/**
* @public
* {@inheritDoc IncrementalUpdater}
*/
export interface IIncrementalUpdater {
readonly isUpdating: boolean;
beginUpdate(): void;
cancel(): void;
suspend(): void;
resume(): void;
}
/**
* @public
* Performs update operations once every `waitPeriod` until the iterator returned by {@link IIncrementallyUpdatable} is
* exhausted.
*/
export declare class IncrementalUpdater implements IIncrementalUpdater {
private updatable;
private waitPeriod;
/**
* Remains true while the update is suspended.
*/
isUpdating: boolean;
constructor(updatable: IIncrementallyUpdatable, waitPeriod?: number);
/**
* Cancel the update and clear the task.
*/
cancel(): void;
/**
* Suspends the current task if one is active.
*/
suspend(): void;
/**
* Start a new update cycle. If an update was already in progress it will be cancelled.
*/
beginUpdate(): void;
/**
* Resumes the currently suspended task. It is an error to call this if there is not a currently suspended task.
*/
resume(): void;
private update;
private currentIterator;
private id;
}
//# sourceMappingURL=incremental-updater.d.ts.map