Files
JiboOs/docs/services/events/index.js
2026-03-16 13:53:01 +02:00

20 lines
737 B
JavaScript

/**
* @description Typed global events for events module (`jibo.globalEvents`).
* Only emits event to LAST subscriber.
* Also emits when a subscriber is added to a particular event AND
* when all subscribers have been removed from particular event (no handlers
* are registered for that event).
* ```
* function handler = (data) => {
* // data is of type asrResult
* // the ASR service has finished listening a cloud result
* // and all subscribed listeners will be removed
* }
* jibo.globalEvents.touchOn.on(handler);
* // When finished with event listening
* jibo.globalEvents.touchOn.removeLastListener();
* // or
* jibo.globalEvents.touchOn.removeListener(handler);
* ```
* @namespace jibo.globalEvents
*/