@just-in/core
Version:
A TypeScript-first framework for building adaptive digital health interventions.
52 lines • 1.99 kB
TypeScript
export declare class EventHandlerManager {
private handlerMap;
private static instance;
private constructor();
/**
* Returns the singleton instance of the EventManager.
*
* @returns {EventManager} The singleton instance of the EventManager.
*/
static getInstance(): EventHandlerManager;
/**
* Registers a custom event by creating a standardized event object and adding it to the queue.
*
* @param {string} eventType - The type of event (e.g., 'CUSTOM_EVENT').
* @param {string[]} handlerNames - The list of handler names associated with the event.
* @returns {Promise<void>}
*/
registerEventHandlers: (eventType: string, handlerNames: string[], overwriteExisting?: boolean) => Promise<void>;
/**
* Unregisters an event handler mapping by its event type.
*
* @param {string} eventType - The event type to unregister.
*/
unregisterEventHandlers: (eventType: string) => void;
/**
* Validates the parameters for an event registration.
*
* @param {string} eventType - The name of the event.
* @param {string[]} handlerNames - The list of handlers.
* @throws {Error} If the eventType or handlers are invalid.
*/
private validateEventHandlerParams;
/**
* Returns the handlers for a given event type.
*
* @param {string} eventType - The event type.
* @returns {string[]} The handler names for the event type.
*/
getHandlersForEventType: (eventType: string) => string[];
/**
* Checks if there are handlers for a given event type.
*
* @param {string} eventType - The event type.
* @returns {boolean} True if there are handlers for the event type, false otherwise.
*/
hasHandlersForEventType: (eventType: string) => boolean;
/**
* Clears all event handlers from the event registry.
*/
clearEventHandlers: () => void;
}
//# sourceMappingURL=event-handler-manager.d.ts.map