Reference Source
public class | source

PulseComponent

You can directly use an instance of this class. Pulse

Static Member Summary

Static Private Members
private static

Array of stored IDs so that multiple of the same ID cannot be claimed

private static

Array that tracks events for instances

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

version: *

The version of the module.

Private Members
private

Weakmap to track data belonging to instances used in this module.

private

The logger module this module uses to log errors / logs

Method Summary

Public Methods
public

off(pInstance: Object, pEventName: string, pFunction: Function)

Removes an event listener function from pInstance

public

on(pInstance: Object, pEventName: string, pFunction: Function)

Adds an event listener function to pInstance to call whenever pEventName is called

Private Methods
private

Generates a random ID based on the specified length and ensures its uniqueness within the stored IDs.

private

listenForEvent(pInstance: Object, pEventName: string)

Listens for an event on an instance.

Static Private Members

private static storedIDs: Array source

Array of stored IDs so that multiple of the same ID cannot be claimed

private static tracker: Array source

Array that tracks events for instances

Public Constructors

public constructor() source

Public Members

public version: * source

The version of the module.

Private Members

private instanceWeakMap: WeakMap source

Weakmap to track data belonging to instances used in this module.

private logger: Object source

The logger module this module uses to log errors / logs

Public Methods

public off(pInstance: Object, pEventName: string, pFunction: Function) source

Removes an event listener function from pInstance

Params:

NameTypeAttributeDescription
pInstance Object

The instance to remove the event listener from

pEventName string

The name of the event to remove

pFunction Function

The function to be removed

public on(pInstance: Object, pEventName: string, pFunction: Function) source

Adds an event listener function to pInstance to call whenever pEventName is called

Params:

NameTypeAttributeDescription
pInstance Object

The instance to add an event listener to

pEventName string

The name of the event to add the listener to

pFunction Function

The function to be called when this event is called

Private Methods

private generateID(pID: number): string source

Generates a random ID based on the specified length and ensures its uniqueness within the stored IDs.

Params:

NameTypeAttributeDescription
pID number
  • optional
  • default: 7

The length of the generated ID.

Return:

string

A unique random ID.

private listenForEvent(pInstance: Object, pEventName: string) source

Listens for an event on an instance. Preserves any original event function code, while also allowing multiple event listeners to call on the same event.

Params:

NameTypeAttributeDescription
pInstance Object

The instance that has the event

pEventName string

The event name to listen for