UNPKG

camelot-unchained

Version:
63 lines (62 loc) 2.69 kB
/** * Register a callback for specified topic. * @method on * @param topic {string} The topic name of the event * @param callback {function} The handler to be called when the event is triggered. * Passed the event data as the first argumnt * @return {any} an event handler id (can be used to stop listening for the event) */ export declare function on(topic: string, callback: (info: any) => void): any; /** * Register a callback for specified topic, once only. Automatically unregisters * from the event one triggered. * @method once * @param topic {string} The topic name of the event * @param callback {function} The handler to be called when the event is triggered. * Passed the event data as the first argument * @return {any} an event handler id (can be used to stop listening for the event) */ export declare function once(topic: string, callback: (info: any) => void): any; /** * Register a callback for specified topic, once only. Automatically unregisters * from the event one triggered. * @method off * @param listener {any} ID returned from a call to on() once() or addEventListener() */ export declare function off(listener: any): void; /** * Trigger an event for a topic, passing the event data (by reference) to any registered * handlers. If passing by reference is an issue, the caller is responsible for cloning. * @method fire * @param topic {string} The topic name of the event * @param data {any} Data to be passed to registered handlers */ export declare function fire(topic: string, data: any): void; export declare function addListener(topic: string, callback: (info: any) => void): void; export declare function removeListener(listener: any): void; declare var _default: { clientEventTopics: { initialize: string; handlesAnnouncements: string; handlesBeginChat: string; handlesPlot: string; handlesLogging: string; handlesInventory: string; handlesFriendlyTarget: string; handlesEquippedGear: string; handlesEnemyTarget: string; handlesControlGameScore: string; handlesControlGame: string; handlesConsole: string; handlesChat: string; handlesCharacter: string; }; on: (topic: string, callback: (info: any) => void) => any; once: (topic: string, callback: (info: any) => void) => any; off: (listener: any) => void; fire: (topic: string, data: any) => void; diagnostics: () => void; addListener: (topic: string, callback: (info: any) => void) => void; removeListener: (listener: any) => void; }; export default _default;