import { type Maybe } from './value/maybe.type'; /** * Object that must be "initialized". */ export interface Initialized { init(): void; } /** * Object that can be "destroyed" as a way to clean itself up. */ export interface Destroyable { destroy(): void; } /** * Used for cleaning up/destroying content. */ export type DestroyFunction = () => void; /** * Retains a reference to a single destroy function. When a new function is set via {@link setDestroyFunction}, * the previous one is called first. Useful for managing cleanup of subscriptions or resources that change over time. * * @example * ```ts * const obj = new DestroyFunctionObject(); * obj.setDestroyFunction(() => console.log('cleanup A')); * obj.setDestroyFunction(() => console.log('cleanup B')); // logs 'cleanup A' * obj.destroy(); // logs 'cleanup B' * ``` */ export declare class DestroyFunctionObject implements Destroyable { private _destroy?; constructor(destroyFunction?: Maybe); get hasDestroyFunction(): boolean; setDestroyFunction(destroyFunction: Maybe): void; get destroy(): DestroyFunction; set destroy(destroyFn: Maybe); clear(): void; }