Class: Signal

PIXI.Signal

new PIXI.Signal ()

Signal.ts:71

MiniSignal constructor.

Example

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

Methods

add (fn, thisArg) PIXI.SignalBinding

Signal.ts:145

Register a new listener.

Name Type Attributes Description
fn Function

Callback function.

thisArg object <optional>

The context of the callback function.

Returns:
Type Description
PIXI.SignalBinding The SignalBinding node that was added.

detach (node) Signal

Signal.ts:179

Remove binding object.

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

Signal.ts:215

Detach all listeners.

Returns:
Type Description
Signal The instance on which this method was called.

dispatch (…args) Boolean

Signal.ts:124

Dispaches a signal to all registered listeners.

Name Type Description
args any[]
Returns:
Type Description
Boolean Indication if we've emitted an event.

handlers (exists) Array<PIXI.SignalBinding> | Boolean

Signal.ts:84

Return an array of attached SignalBinding.

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 (node) Boolean

Signal.ts:108

Return true if node is a SignalBinding attached to this MiniSignal

Name Type Description
node PIXI.SignalBinding

Node to check.

Returns:
Type Description
Boolean True if node is attache to mini-signal

once (fn, thisArg) PIXI.SignalBinding

Signal.ts:162

Register a new listener that will be executed only once.

Name Type Attributes Description
fn Function

Callback function.

thisArg object <optional>

The context of the callback function.

Returns:
Type Description
PIXI.SignalBinding The SignalBinding node that was added.