import type { Disposer } from "./types/index.js"; /** * The shape {@link register_weak_disposer} needs from a `WeakRef`. Declared * structurally so tests can hand in a stub that reports its target as * collected — real garbage collection is not schedulable, and a guarantee * about releasing memory deserves a deterministic test. */ export type RefLike = { deref: () => T | undefined; }; /** Register a cleanup function that runs unconditionally at teardown. */ export declare const register_disposer: (run: Disposer) => void; /** * Register a cleanup function bound to `ref`'s target, held weakly. * * The registry never retains the target, so an object that becomes * unreachable is collectable whether or not it was cleaned up first, and its * entry is skipped at teardown — there is nothing left to clean up. */ export declare const register_weak_disposer: (ref: RefLike, run: (target: T) => Promise) => void; /** * Run every live disposer in reverse registration order, sequentially, so a * disposer can rely on later-registered ones having already finished. * * Registrations are left in place, so a second teardown call re-runs them, * exactly as before this registry learned about weak entries. */ export declare const run_disposers: () => Promise; //# sourceMappingURL=disposers.d.ts.map