Overview
The Event Bus (api.bus) is a simple pub/sub system that lets plugins communicate without importing each other.
API
bus.on(event, callback)
Subscribe to an event.
bus.off(event, callback)
Unsubscribe. Must pass the same function reference.
bus.once(event, callback)
Subscribe to an event, but auto-remove the listener after the first emission.
bus.emit(event, data)
Publish an event to all subscribers. Errors in listeners are caught and logged without interrupting other listeners.
bus.removeAll([event])
Remove all listeners for a specific event, or all events if no name is given.
Naming Convention
Usenamespace:action to avoid collisions between plugins:
Built-in Events
See Built-in Events for full details.