import { IDisposable } from './dispose'; export type INodeFunc = (node: Node) => void; /** @internal */ export declare function _disposeNode(node: Node): void; export interface IDomDisposeHooks { disposeRecursive: (node: Node) => void; disposeNode: (node: Node) => void; } /** * Support for extending dom disposal. This is very low-level, and needs utmost care. Any * disposers set should take care of calling the original versions of the disposers. */ export declare const domDisposeHooks: IDomDisposeHooks; /** * Run disposers associated with any descendant of elem or with elem itself. Disposers get * associated with elements using dom.onDispose(). Descendants are processed first. * * It is automatically called if one of the function arguments to dom() throws an exception during * element creation. This way any onDispose() handlers set on the unfinished element get called. * * @param node - The element to run disposers on. */ export declare function domDispose(node: Node): void; /** * Associate a disposer function with a DOM element. It will be called when the element is disposed * using `domDispose()` on it or any of its parents. If called multiple times, all * disposer functions will be called in reverse order. * * Note that it is not necessary usually to dispose event listeners attached to an element (e.g. * with `dom.on()`) since their lifetime is naturally limited to the lifetime of the element. * * @param elem - The element to associate the disposer with. * @param disposerFunc - Will be called when `domDispose()` is called on the element or its ancestor. */ export declare function onDisposeElem(elem: Node, disposerFunc: INodeFunc): void; /** * Associate a disposer function with a DOM element. It will be called when the element is disposed * using `domDispose()` on it or any of its parents. If called multiple times, all * disposer functions will be called in reverse order. * * @param disposerFunc - Will be called when `domDispose()` is called on the element or its ancestor. */ export declare function onDispose(disposerFunc: INodeFunc): (elem: Node) => void; /** * Make the given element own the disposable, and call its dispose method when `domDispose()` is * called on the element or any of its parents. * @param elem - The element to own the disposable. * @param disposable - Anything with a `.dispose()` method. */ export declare function autoDisposeElem(elem: Node, disposable: IDisposable | null): void; /** * Make the given element own the disposable, and call its dispose method when `domDispose()` is * called on the element or any of its parents. * * @param disposable - Anything with a `.dispose()` method. */ export declare function autoDispose(disposable: IDisposable | null): ((elem: Node) => void) | undefined;