UNPKG

@aotearoan/neon

Version:

Neon is a lightweight design library of Vue 3 components with minimal dependencies.

32 lines (31 loc) 1.17 kB
/** * Event bus used internally for component to component communication. All Neon messages are namespaced with the * <em>neon-</em> messagePrefix. Feel free to also use it in applications, just use a different namespace so as not to * clash with Neon's messages. */ export declare class NeonEventBus { /** Message prefix used for Neon internal messages. */ static messagePrefix: string; private static listeners; /** * Start listening to event bus events. * * @param event The event topic to listen for. * @param callback Callback to be triggered when an event is received. */ static on(event: string, callback: (...args: any[]) => void): void; /** * Stop listening to event bus events. * * @param event The event topic to listen for. * @param callback Callback to stop triggering. */ static off(event: string, callback: (...args: any[]) => void): void; /** * Emit an event bus event on a specific topic. * * @param event The topic on which to send the event. * @param args The event arguments to send. */ static emit(event: string, ...args: any[]): void; }