Methods

bus.emit

Emits an event.

bus.emit(type: string, payload?: {})

bus.debouncedEmit

Returns a debounced emit function. Useful when it is undesirable to emit the same event many times in a short period of time.

bus.debouncedEmit(delay: number, type: string): (payload) => {}

bus.on

Subscribes to an event.

bus.on(type: string, listener: function)

Subscribes to all events.

bus.on('*', listener: function)

bus.once

Subscribes to an event once.

bus.once(type: string, listener: function)

bus.off

Unsubscribes to an event.

bus.off(type: string, listener: function)

bus.removeAllListeners

Removes all listeners on a given bus.

bus.removeAllListeners()