import { ListenerMap, TypedEventEmitter } from "matrix-js-sdk/src/matrix";
import type { EventEmitter } from "events";
type Handler = (...args: any[]) => void;
export declare function useTypedEventEmitter<Events extends string, Arguments extends ListenerMap<Events>>(emitter: TypedEventEmitter<Events, Arguments> | undefined, eventName: Events, handler: Handler): void;
/**
 * Hook to wrap an EventEmitter on and off in hook lifecycle
 */
export declare function useEventEmitter(emitter: EventEmitter | undefined, eventName: string | symbol, handler: Handler): void;
type Mapper<T> = (...args: any[]) => T;
/**
 * {@link useEventEmitterState}
 */
export declare function useTypedEventEmitterState<T, Events extends string, Arguments extends ListenerMap<Events>>(emitter: TypedEventEmitter<Events, Arguments> | undefined, eventName: Events, fn: Mapper<T>): T;
/**
 * Creates a state, that can be updated by events.
 *
 * @param emitter The emitter sending the event
 * @param eventName Event name to listen for
 * @param fn The callback function, that should return the state value.
 *           It should have the signature of the event callback, except that all parameters are optional.
 *           If the params are not set, a default value for the state should be returned.
 * @returns State
 */
export declare function useEventEmitterState<T>(emitter: EventEmitter | undefined, eventName: string | symbol, fn: Mapper<T>): T;
export {};
