Events
The events module allows you to set callbacks for and trigger custom events. This is useful for when you want to trigger a function when a specific 'event' or action happens in your code.
To access the events module, use the Events
key via the module loader.
The on()
method sets a callback for an event name.
The fire()
method calls all the callbacks on an event. They are fired in the order they were set.
The off()
method removes a callback for an event name.