JEventLib

JEventLib

Class for defining custom events to receive from the websocket

Constructor

# new JEventLib()

Methods

# (static) addEvent(name, callback) → {void}

Adds a websocket listener event
Parameters:
Name Type Description
name string the name of the ws event
callback callback the function to be invoked when the event occurs
Returns:
Type
void

# (static) addSingletonEvent(name, callback) → {void}

Adds a websocket listener event only if none with the same name exists
Parameters:
Name Type Description
name string the name of the ws event
callback callback the function to be invoked when the event occurs
Returns:
Type
void

# (static) invoke(name, params) → {void}

Runs a specific websocket event
Parameters:
Name Type Description
name string the name of the event
params any parameters which are being passed to the callback functions
Returns:
Type
void

# (static) overrideSingletonEvent(name, callback) → {void}

Adds a websocket listener event and remove all existing events with the same name
Parameters:
Name Type Description
name string the name of the ws event
callback callback the function to be invoked when the event occurs
Returns:
Type
void