import { Listener, Emitter } from "./types"; /** * Creates an event emitter for managing and notifying listeners. * * An emitter provides a simple pub/sub pattern for managing event listeners. * It's used internally by signals and effects to manage subscriptions and notifications. * * Features: * - Add listeners that will be notified when events are emitted * - Emit events to all registered listeners * - Remove listeners via unsubscribe functions * - Clear all listeners at once * - Safe to call unsubscribe multiple times (idempotent) * * @template T - The type of payload that will be emitted to listeners (defaults to void) * @returns An emitter object with add, emit, and clear methods * * @example * ```ts * const eventEmitter = emitter(); * * // Subscribe to events * const unsubscribe = eventEmitter.on((message) => { * console.log('Received:', message); * }); * * // Emit an event * eventEmitter.emit('Hello'); // Logs: "Received: Hello" * * // Unsubscribe * unsubscribe(); * * // Clear all listeners * eventEmitter.clear(); * ``` */ export declare function emitter(initialListeners?: Listener[]): Emitter; //# sourceMappingURL=emitter.d.ts.map