/** * JQHTML Component Event System * * Extracted from component.ts - handles lifecycle event registration, * triggering, and state tracking. * * Every handler runs with `this` bound to the component and the component as its first * argument, whether it fires from trigger(), as a once() handler, or immediately on * registration (sticky replay). * * EVERY event is "sticky", not just the lifecycle ones: trigger() records the event * name and its payload, and a handler registered afterwards fires immediately with that * last payload. This is deliberate and applies to custom events too - a subscriber that * arrives after `trigger('row_selected', row)` still learns which row is selected, * which is what makes late-attaching UI work without a separate "current state" read. */ /** * Register a callback for an event. * * All events are "sticky", lifecycle (create, render, load, loaded, ready, stop) and * custom alike: if the event has already been triggered, the callback fires immediately * with the payload of that last trigger AND registers for future occurrences. * * invalidate(event_name) drops the stored marker when a component wants later * subscribers to wait for the next real occurrence instead (reload() does this for * 'ready'). * * @param component - The component instance * @param event_name - Name of the event * @param callback - Callback: (component, data?) => void */ export declare function event_on(component: any, event_name: string, callback: (this: any, comp: any, data?: any) => void): any; /** * Register a callback that fires exactly once. * * - If the event already occurred (sticky), fires immediately and does NOT register. * - If the event has not occurred, registers and auto-deregisters after first fire. * * @param component - The component instance * @param event_name - Name of the event * @param callback - Callback: (component, data?) => void */ export declare function event_once(component: any, event_name: string, callback: (this: any, comp: any, data?: any) => void): any; /** * Trigger an event - fires all registered callbacks. * Marks event as occurred so future .on() calls fire immediately. * * @param component - The component instance * @param event_name - Name of the event to trigger * @param data - Optional data to pass to callbacks as second parameter */ export declare function event_trigger(component: any, event_name: string, data?: any): void; /** * Check if any callbacks are registered for a given event. * * @param component - The component instance * @param event_name - Name of the event to check */ export declare function event_on_registered(component: any, event_name: string): boolean; /** * Invalidate a lifecycle event - removes the "already occurred" marker. * * After invalidate() is called: * - New .on() handlers will NOT fire immediately * - The ready() promise will NOT resolve immediately * - Handlers wait for the next trigger() call * * Existing registered callbacks are NOT removed - they'll fire on next trigger(). * * Use case: Call invalidate('ready') at the start of reload() or render() * so that any new .on('ready') handlers wait for the reload/render to complete. * * @param component - The component instance * @param event_name - Name of the event to invalidate */ export declare function event_invalidate(component: any, event_name: string): void; //# sourceMappingURL=component-events.d.ts.map