import type { OneArgFn, ErrFn, Listener } from '../types.js'; import { Emitter } from '../../index.js'; /** * Calls `fn` the next time `emitter` is activated. * * @param fn The function to be called once emitter is activated. * @param errFn A function to be called if emitter is deactivated instead of * cancelled. By default `Error`'s are swallowed, otherwise the async function * called within would cause an `UnhandledPromiseRejection`. * @returns a `Function` to cancel *emitter* specific listener. */ export declare function onceCancellable(emitter: Listener, fn: OneArgFn, errFn?: ErrFn): Function; /** * Calls `fn` every time `emitter` is activated. * Stops after a cancellation or deactivation. * * @param fn The function to be called once the emitter is activated. * @param errFn A function to be called if the emitter is deactivated instead of * cancelled. By default `Error`'s are swallowed, otherwise the async function * called within would cause an `UnhandledPromiseRejection`. * @returns a `Function` to cancel *emitter* specific listener at * the end of the current thread. Note: Activations have priority over emitter canceller. */ export declare function onCancellable(emitter: Emitter, fn: OneArgFn, errFn?: ErrFn): () => Emitter;