import { _ as LoggerInterface } from "./log-base-omQ8fkjE.cjs"; import { n as DisposerFunction } from "./dispose-types-CVL-NcAL.cjs"; import { r as UseDisposeConfig } from "./dispose-defer-BoCXEHoJ.cjs"; //#region src/common/dispose-utils.d.ts type TimerExecFunction = () => void | Promise; /** Returns a no-op disposer (shared instance, no allocation per call). */ declare const noopDisposer: () => DisposerFunction; /** * Executes a function after a specified timeout and returns a disposer function * that can be used to cancel the timeout. * * @param fn - The function to execute after the timeout. * @param timeout - The timeout duration in milliseconds (default: 0). * @returns A disposer function that can be used to cancel the timeout. */ declare function useTimeout(fn: TimerExecFunction, timeout?: number): DisposerFunction; /** * Executes a function repeatedly at a specified interval and returns a disposer function * that can be used to stop the execution. * * @param fn - The function to be executed at the specified interval. * @param interval - The interval (in milliseconds) at which the function should be executed. * @returns A disposer function that can be used to stop the execution of the function. */ declare function useInterval(fn: TimerExecFunction, interval: number): DisposerFunction; /** The interval starts only, when the function is finished. */ declare function useIntervalPause(fn: TimerExecFunction, interval: number, immediately?: boolean): DisposerFunction; declare function useEventListener(emitter: any, eventName: string, fn: (ev?: any) => void, ...args: any[]): DisposerFunction; declare function useEventListenerOnce(emitter: any, eventName: string, fn: (ev?: any) => void, ...args: any[]): DisposerFunction; /** Like useDispose but with shorthands for emitter and timers */ declare function useDisposeWithUtils(config?: string | UseDisposeConfig | LoggerInterface): ((strictSync?: boolean) => Promise | void) & { readonly disposed: number; add: (obj?: DisposerFunction | { dispose: DisposerFunction; }) => DisposerFunction | undefined; remove: (disposable: DisposerFunction | { dispose: DisposerFunction; }) => Promise | void; track: (obj?: DisposerFunction | { dispose: DisposerFunction; }) => DisposerFunction | undefined; untrack: (disposable: DisposerFunction | { dispose: DisposerFunction; }) => Promise | void; dispose: (strictSync?: boolean) => Promise | void; disposeSync: () => void; sync: () => void; exec: (strictSync?: boolean) => Promise | void; getSize(): number; isDisposed(): boolean; [Symbol.dispose](): void | Promise; [Symbol.asyncDispose](): Promise; } & { timeout: (fn: TimerExecFunction, timeout?: number) => DisposerFunction; interval: (fn: TimerExecFunction, interval?: number) => DisposerFunction; intervalPause: (fn: TimerExecFunction, interval?: number) => DisposerFunction; on: (emitter: any, eventName: string, fn: (ev?: any) => void, ...args: any[]) => DisposerFunction; once: (emitter: any, eventName: string, fn: (ev?: any) => void, ...args: any[]) => DisposerFunction; }; type UseDisposeWithUtils = ReturnType; //#endregion export { useEventListener as a, useIntervalPause as c, useDisposeWithUtils as i, useTimeout as l, UseDisposeWithUtils as n, useEventListenerOnce as o, noopDisposer as r, useInterval as s, TimerExecFunction as t }; //# sourceMappingURL=dispose-utils-EQJPLtnc.d.cts.map