What it does
events.on acts on events: it listens. It takes name and a function, and answers unsubscribe fn.
Signature
events.on(name, (data) => {...}) → unsubscribe fnArguments
name(data) => {...}Accepts:
data
Example · generated
function start() { const result = events.on('main', (data) => {});}events.on is called with values of the shape its signature asks for. The code sits in start(), which the engine calls once, when the entity spawns.