TComponents. Eventing_A

new Eventing_A()

Event manager base class

Example
const eventingInstance = new TComponents.Eventing_A();

Methods

anyEvent() → {boolean}

Check if any event has been registered already

Returns:
  • True if any event has been registered already, false otherwise
Type: 
boolean

cleanEvent(eventName)

Clean up a specific event

Parameters:
NameTypeDescription
eventNamestring

The event name you want to clean

cleanUpEvents(ignoresopt)

Clean up all registered events except those in the ignore list

Parameters:
NameTypeAttributesDefaultDescription
ignoresArray.<string><optional>
['before:init', 'after:render', 'before:destroy']

Event list you don't want to clean

count(eventName) → {number}

Get the number of callbacks subscribed to an event

Parameters:
NameTypeDescription
eventNamestring

Name of the triggering event

Returns:
  • Number of callbacks subscribed to the event
Type: 
number

hasEvent(eventName) → {boolean}

Check if an event has been registered already

Parameters:
NameTypeDescription
eventNamestring

Name of the triggering event

Returns:
  • True if the event has been registered already, false otherwise
Type: 
boolean

off(eventName, callback) → {boolean}

Unsubscribe from an event

Parameters:
NameTypeDescription
eventNamestring

Name of the triggering event

callbackfunction

Function to be removed from the event's callbacks

Returns:
  • True if the callback was removed, false if it was not found
Type: 
boolean

on(eventName, callback, strictopt)

Subscribe to an event

Parameters:
NameTypeAttributesDefaultDescription
eventNamestring

Name of the triggering event

callbackfunction

Function to be called when the event is triggered

strictboolean<optional>
true

If true (default), checking whether the function has been added is done by function object comparison, otherwise, the comparison is done only by function.name

once(eventName, callback) → {boolean}

Subscribe to an event, but the callback is called only once

Parameters:
NameTypeDescription
eventNamestring

Name of the triggering event

callbackfunction

Function to be called when the event is triggered

Returns:
  • True if the callback was added, false if it was already added
Type: 
boolean