Skip to content

Latest commit

 

History

History
173 lines (77 loc) · 2.26 KB

File metadata and controls

173 lines (77 loc) · 2.26 KB

Home > server > EventRouter

EventRouter class

Manages event emission and assigned listener callbacks.

Signature:

export default class EventRouter 

Methods

Method

Modifiers

Description

emit(eventType, payload)

Emit an event, invoking all registered listeners for the event type.

emitWithGlobal(eventType, payload)

Emits an event to the local and global server instance event routers.

emitWithWorld(world, eventType, payload)

Emits an event to local and provided world event routers.

hasListeners(eventType)

Check if there are listeners for a specific event type.

listenerCount(eventType)

Get the number of listeners for a specific event type.

listeners(eventType)

Get all listeners for a specific event type.

off(eventType, listener)

Remove a listener for a specific event type.

offAll(eventType)

Remove all listeners or all listeners for a provided event type.

on(eventType, listener)

Register a listener for a specific event type.

once(eventType, listener)

Register a listener for a specific event type that will be invoked once.