UNPKG

histoire

Version:

A fast story book powered by Vite

23 lines • 1.41 kB
/** Resource disposer registered immediately after acquisition. */ export type RuntimeCleanup = () => void | Promise<void>; /** Teardown failed or timed out; project ownership cannot be safely transferred. */ export declare class RuntimeCleanupError extends AggregateError { /** Stable marker survives duplicate module instances and worker serialization. */ readonly code = "HISTOIRE_RUNTIME_CLEANUP_FAILED"; /** Preserves original failures while marking unconfirmed resource release. */ constructor(errors: unknown[], message: string); } /** Finds unconfirmed teardown even when startup preserved it in an aggregate. */ export declare function hasUnconfirmedCleanup(error: unknown): boolean; /** Bounds owned resource teardown without leaving an unobserved rejection. */ export declare function withCleanupDeadline<T>(promise: Promise<T>, timeout?: number): Promise<T>; /** Closes every acquired resource in reverse dependency order, including after failures. */ export declare function createCleanupStack(): { /** Shutdown admission fence, visible before asynchronous disposers finish. */ readonly isClosing: boolean; /** Registers an owned resource while acquisition is still active. */ add(cleanup: RuntimeCleanup): void; /** Invokes disposers once; all attempts occur even when a disposer throws. */ close(): Promise<void>; }; //# sourceMappingURL=cleanup.d.ts.map