import { Fn } from '@solidjs-use/shared'; type EventBusListener = (event: T, payload?: P) => void; type EventBusEvents = Set>; type EventBusKey = Symbol; type EventBusIdentifier = EventBusKey | string | number; interface UseEventBusReturn { /** * Subscribe to an event. When calling emit, the listeners will execute. * @param listener watch listener. * @returns a stop function to remove the current callback. */ on: (listener: EventBusListener) => Fn; /** * Similar to `on`, but only fires once * @param listener watch listener. * @returns a stop function to remove the current callback. */ once: (listener: EventBusListener) => Fn; /** * Emit an event, the corresponding event listeners will execute. * @param event data sent. */ emit: (event?: T, payload?: P) => void; /** * Remove the corresponding listener. * @param listener watch listener. */ off: (listener: EventBusListener) => void; /** * Clear all events */ reset: () => void; } /** * A basic event bus. * * @see https://solidjs-use.github.io/solidjs-use/core/useElementVisibility */ declare function useEventBus(key: EventBusIdentifier): UseEventBusReturn; export { EventBusEvents, EventBusIdentifier, EventBusKey, EventBusListener, UseEventBusReturn, useEventBus };