export type CleanupHandler = () => void | Promise; export interface CleanupScope { add(cleanup: CleanupHandler): void; dispose(): Promise; } export interface ManagedObserver { disconnect(): void; } export interface BoundaryScope extends CleanupScope { mountChild(boundary: Boundary, root: Element): Promise>; } export interface BoundarySpec { mount(root: Element, scope: BoundaryScope): TState | Promise; unmount?(state: TState, scope: BoundaryScope): void | Promise; snapshotState?(state: TState): unknown | Promise; restoreState?(root: Element, scope: BoundaryScope, state: unknown): TState | Promise; } export interface Boundary { mount(root: Element): Promise; unmount(): Promise; } export declare function createCleanupScope(): CleanupScope; export declare function listen(scope: CleanupScope, target: EventTarget, type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; export declare function scheduleTimeout(scope: CleanupScope, callback: TimerHandler, delay?: number, ...args: unknown[]): Parameters[0]; export declare function scheduleInterval(scope: CleanupScope, callback: TimerHandler, delay?: number, ...args: unknown[]): Parameters[0]; export declare function trackObserver(scope: CleanupScope, observer: TObserver): TObserver; export declare function createAbortController(scope: CleanupScope): AbortController; export declare function defineBoundary(spec: BoundarySpec): Boundary;