API Docs for: 1.0.0
Show:

Kiwi.Signal Class

Defined in: src\core\Signal.ts:9
Module: Kiwi

A TypeScript conversion of JS Signals by Miller Medeiros. Released under the MIT license http://millermedeiros.github.com/js-signals/

Methods

_addBinding

(
  • binding
)
private

Handles the process of adding a new SignalBinding to the bindings list by the new Bindings priority.

Parameters:

_indexOfListener

(
  • listener
  • context
)
Number private

Returns the index of any Binding which matches the listener and context that is passed. If none match then this method returns -1.

Parameters:

  • listener Function

    The method that we are checking to see.

  • context Any

    The context of the method we are checking.

Returns:

Number:

The index of listener/context.

dispatch

(
  • [params]
)
public

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

Parameters:

  • [params] Any optional multiple

    Parameters that should be passed to each handler.

dispose

() public

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

IMPORTANT: calling any method on the signal instance after calling dispose will throw errors.

forget

() public

Forget memorized arguments. See Signal.memorize

getNumListeners

() Number public

Returns the number of listeners that have been attached to this Signal.

Returns:

Number:

Number of listeners attached to the Signal.

halt

() public

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

IMPORTANT: should be called only during signal dispatch, calling it before/after dispatch won't affect signal broadcast.

objType

() String public

Returns the type of this object

Returns:

String:

"Signal"

removeAll

() public

Remove all listeners from the Signal.

validateListener

(
  • listener
  • fnName
)
public

Validates a event listener an is used to check to see if it is valid or not. If a event listener is not valid, then a Error is thrown.

Parameters:

  • listener Any
  • fnName Any

Properties

_bindings

Array private

A list of all of the signal bindings that are on this signal.

_prevParams

Any private

active

Boolean public

If Signal is active and should broadcast events.

IMPORTANT: Setting this property during a dispatch will only affect the next dispatch, if you want to stop the propagation of a signal use halt() instead.

Default: true

memorize

Boolean public

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

Default: false

VERSION

String public final static

Signals Version Number