Events

Base events class to handle custom events.

Constructor

new Events(eventNamesopt, senderopt)

Parameters:
NameTypeAttributesDescription
eventNamesArray.<string><optional>

Event names that could be dispatched.

sender*<optional>

Methods

(protected) _stamp(name, obj) → {boolean}

Returns true if event callback has stamped.

Parameters:
NameTypeDescription
nameObject

Event identifier.

objObject

Event callback.

Returns:
Type: 
boolean

clear()

Removes all events.

dispatch(event, …argsopt)

Dispatch event.

Parameters:
NameTypeAttributesDescription
eventEventCallbackHandler

Event instance property that created by event name.

argsObject<optional>
<repeatable>

Callback parameters.

off(name, callback)

Stop listening event name with specified callback function.

Parameters:
NameTypeDescription
namestring

Event name.

callbackEventCallback | null

Attached event callback.

on(name, callback, senderopt, priorityopt)

Attach listener.

Parameters:
NameTypeAttributesDefaultDescription
namestring

Event name to listen.

callbackEventCallback

Event callback function.

senderany<optional>

Event callback function owner.

prioritynumber<optional>
0

Priority of event callback.

registerNames(eventNames)

Function that creates event object properties that would be dispatched.

Parameters:
NameTypeDescription
eventNamesArray.<string>

Specified event names list.

stopPropagation()

Brakes events propagation.