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.
25 lines • 854 B
TypeScript
/**
* @public
* Represents a store that allows adding, removing, and executing cleanup callbacks.
*/
export interface ICleanupRegistry {
/**
* Execute the cleanup code, then delete the cleanup callbacks (i.e. reset this object, ready to use again).
*/
executeCleanups(): void;
unregisterCleanup(cleanup: () => void): void;
registerCleanup(cleanup: () => void): void;
listCleanups(): readonly (() => void)[];
}
/**
* @public
* Strong reference implementation of {@link ICleanupRegistry}.
*/
export declare class CleanupRegistry implements ICleanupRegistry {
executeCleanups(): void;
registerCleanup(listener: () => void): void;
unregisterCleanup(listener: () => void): void;
listCleanups(): readonly (() => void)[];
private readonly cleanupCallbacks;
}
//# sourceMappingURL=cleanup-registry.d.ts.map