/** * Global Event Bus System * Pub/sub pattern for cross-component communication * * @example * // Component A - emit event * Gyos.emit('user-login', { id: 123, name: 'John' }); * * // Component B - listen for event * Gyos.on('user-login', (user) => { * console.log('User logged in:', user); * }); */ /** * Subscribe to an event * * @param event - Event name to listen for * @param handler - Callback function to execute when event is emitted * @returns Unsubscribe function * * @example * // Subscribe * const unsubscribe = Gyos.on('data-changed', (data) => { * console.log('Data:', data); * }); * * // Unsubscribe later * unsubscribe(); */ export declare function on(event: string, handler: Function): () => void; /** * Emit an event * * @param event - Event name to emit * @param args - Arguments to pass to handlers * * @example * Gyos.emit('cart-updated', { items: 3, total: 99.99 }); * Gyos.emit('modal-close'); */ export declare function emit(event: string, ...args: any[]): void; /** * Unsubscribe from an event * * @param event - Event name * @param handler - Specific handler to remove (optional, removes all if not provided) * * @example * // Remove specific handler * Gyos.off('data-changed', myHandler); * * // Remove all handlers for event * Gyos.off('data-changed'); */ export declare function off(event: string, handler?: Function): void; /** * Subscribe once - handler will be called only once then auto-unsubscribed * * @param event - Event name to listen for * @param handler - Callback function (will only execute once) * @returns Unsubscribe function * * @example * // Listen for first load only * Gyos.once('app-ready', () => { * console.log('App is ready!'); * }); * * Gyos.emit('app-ready'); // Handler called * Gyos.emit('app-ready'); // Handler NOT called (already unsubscribed) */ export declare function once(event: string, handler: Function): () => void; /** * Get all active event listeners (for debugging) * * @example * console.log('Active events:', Gyos.getEventListeners()); */ export declare function getEventListeners(): Record; /** * Clear all event listeners * Useful for cleanup in tests or when unmounting app * * @example * Gyos.clearAllEvents(); */ export declare function clearAllEvents(): void; //# sourceMappingURL=events.d.ts.map