Skip to content

Latest commit

 

History

History
22 lines (17 loc) · 509 Bytes

sending-and-receiving-events.md

File metadata and controls

22 lines (17 loc) · 509 Bytes

Event API

Noodl.eventEmitter.emit(eventName, data)
Send an event. Works well together with Event Receivers.

Noodl.eventEmitter.emit('event name', {
  value: 'hello',
  someOtherValue: 100,
});

Noodl.eventEmitter.on(eventName, callback(data))
Noodl.eventEmitter.once(eventName, callback(data))

Receive an event. Works together with Event Senders

Noodl.eventEmitter.on('event name', function (eventData) {
  console.log(eventData.value);
});