PIXI.Signal

class Signal

Constructor


new PIXI.Signal() → {}

MiniSignal constructor.


 let mySignal = new Signal();
 let binding = mySignal.add(onSignal);
 mySignal.dispatch('foo', 'bar');
 mySignal.detach(binding);

Public Methods


add Signal.ts:145
add(fn: Function, thisArg: object) → {PIXI.SignalBinding}

Register a new listener.

Parameters:
Name Type Attributes Default Description
fn Function

Callback function.

thisArg object

<optional>

undefined

The context of the callback function.

Returns:
Type Description
PIXI.SignalBinding

The SignalBinding node that was added.

detach Signal.ts:177
detach(node: PIXI.SignalBinding) → {Signal}

Remove binding object.

Parameters:
Name Type Description
node PIXI.SignalBinding

The binding node that will be removed.

Returns:
Type Description
Signal

The instance on which this method was called.

detachAll Signal.ts:212
detachAll() → {Signal}

Detach all listeners.

Returns:
Type Description
Signal

The instance on which this method was called.

dispatch Signal.ts:124
dispatch(args: any) → {boolean}

Dispaches a signal to all registered listeners.

Parameters:
Name Type Description
args any
Returns:
Type Description
boolean

Indication if we've emitted an event.

handlers Signal.ts:86
handlers(exists: boolean) → {Array<PIXI.SignalBinding> | boolean}

Return an array of attached SignalBinding.

Parameters:
Name Type Attributes Default Description
exists boolean

<optional>

false

We only need to know if there are handlers.

Returns:
Type Description
Array<PIXI.SignalBinding> | boolean

Array of attached SignalBinding or Boolean if called with exists = true

has Signal.ts:109
has(node: PIXI.SignalBinding) → {boolean}

Return true if node is a SignalBinding attached to this MiniSignal

Parameters:
Name Type Description
node PIXI.SignalBinding

Node to check.

Returns:
Type Description
boolean

True if node is attache to mini-signal

once Signal.ts:161
once(fn: Function, thisArg: object) → {PIXI.SignalBinding}

Register a new listener that will be executed only once.

Parameters:
Name Type Attributes Default Description
fn Function

Callback function.

thisArg object

<optional>

undefined

The context of the callback function.

Returns:
Type Description
PIXI.SignalBinding

The SignalBinding node that was added.


Powered by webdoc!