Skip to main content

events

Description​

This library includes functions that handle event management.

Properties​

PropertyDescription
globalIdUsed to dispatch/listen for events globally.

Functions​

addListener​

Registers a component to listen to an event.

world.events.addListener(target: eid, name: string, listener: function) -> void

removeListener​

Un-registers an existing listener

world.events.removeListener(target: eid, name: string, listener: function) -> void

dispatch​

Used to emit events that the listeners can listen to.

world.events.dispatch(target: eid, name: string, data: object /* (optional) */) -> void