Interface Signal

Index

Properties

Methods

Properties

public VERSION: string

Signals Version Number

public active: boolean

If Signal is active and should broadcast events.

public memorize: boolean

If Signal should keep record of previously dispatched parameters and automatically execute listener during add()/addOnce() if Signal was already dispatched before.

Methods

public add(listener: Function, listenerContext?: any, priority?: Number): SignalBinding

Add a listener to the signal.

Parameters

  • listener: Function

    Signal handler function.

  • listenerContext?: any optional
  • priority?: Number optional

    The priority level of the event listener. Listeners with higher priority will be executed before listeners with lower priority. Listeners with same priority level will be executed at the same order as they were added. (default = 0)

Returns

SignalBinding

public addOnce(listener: Function, listenerContext: any, priority: any): SignalBinding

Add listener to the signal that should be removed after first execution (will be executed only once).

Parameters

  • listener: Function

    Signal handler function.

  • listenerContext: any
  • priority: any

    The priority level of the event listener. Listeners with higher priority will be executed before listeners with lower priority. Listeners with same priority level will be executed at the same order as they were added. (default = 0)

Returns

SignalBinding

public dispatch(params?: Array<any>): any

Dispatch/Broadcast Signal to all listeners added to the queue.

Parameters

  • params?: Array<any> optional

    Parameters that should be passed to each handler.

Returns

any

public dispose(): any

Remove all bindings from signal and destroy any reference to external objects (destroy Signal object).

Returns

any

public forget(): any

Forget memorized arguments.

Returns

any

public getNumListeners(): number

Returns a number of listeners attached to the Signal.

Returns

number

public halt(): any

Stop propagation of the event, blocking the dispatch to next listeners on the queue.

Returns

any

public has(listener: Function, context?: any): boolean

Check if listener was attached to Signal.

Parameters

  • listener: Function
  • context?: any optional

Returns

boolean

public remove(listener: Function, context?: any): Function

Remove a single listener from the dispatch queue.

Parameters

  • listener: Function
  • context?: any optional

Returns

Function

public removeAll(): any

Returns

any