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) addPageEvent(name, callback) → {void}

Adds a temporary 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) addSingletonPageEvent(name, callback) → {void}

Adds a temporary 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) clearEvent(name) → {void}

Removes all websocket listener events and with the same name
Parameters:
Name Type Description
name string the name of the ws event
Returns:
Type
void

# (static) clearPageEvents() → {void}

Removes all temporary websocket listener events
Returns:
Type
void

# (async, 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

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

Adds a temporary 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

# (static) setSingletonEvent(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

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

Adds a temporary 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