A common, shared event handler used across multiple TotallyInformation packages. Implemented as a singleton class.
npm install @totallyinformation/ti-common-event-handlerA common, shared event handler used across multiple TotallyInformation packages.
Implemented as a singleton class.
Uses the enhanced EventEmitter2 library for improved performance and support of wildcards
``bash`
npm install @totallyinformation/ti-common-event-handler
`js
const tiEvents = require('@totallyinformation/ti-common-event-handler')
const aDataVar = {
some: 'data'
}
tiEvents.emit('my-event-name', aDataVar)
// NB: Don't use arrow functions if you want to be able to access event name
tiEvents.on('my-event-name', function(data) {
console.log(Event ${this.event} triggered: , data)`
})
* and can be used as wildcards when creating event listeners. will look down all sub-namespaces.
/` is pre-configured as the namespace separator so as to match the equivalent in MQTT topics.
See the EventEmitter2 node for details.
* node-red-contrib-uibuilder
* node-red-contrib-events
* node-red-contrib-drayton-wiser