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);
Summary
Methods from Signal
| PIXI.SignalBinding |
|
| Signal |
|
| Signal |
|
| boolean |
|
| Array<PIXI.SignalBinding> | boolean |
|
| boolean |
|
| PIXI.SignalBinding |
|
Public Methods
add(fn: Function, thisArg: object) → {PIXI.SignalBinding}
Register a new listener.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
| fn | Function |
Callback function. |
||
| thisArg | object |
<optional> |
undefined |
The context of the callback function. |
| Type | Description |
|---|---|
| PIXI.SignalBinding |
The SignalBinding node that was added. |
detach(node: PIXI.SignalBinding) → {Signal}
Remove binding object.
| Name | Type | Description |
|---|---|---|
| node | PIXI.SignalBinding |
The binding node that will be removed. |
| Type | Description |
|---|---|
| Signal |
The instance on which this method was called. |
detachAll() → {Signal}
Detach all listeners.
| Type | Description |
|---|---|
| Signal |
The instance on which this method was called. |
dispatch(args: any) → {boolean}
Dispaches a signal to all registered listeners.
| Name | Type | Description |
|---|---|---|
| args | any |
| Type | Description |
|---|---|
| boolean |
Indication if we've emitted an event. |
handlers(exists: boolean) → {Array<PIXI.SignalBinding> | boolean}
Return an array of attached SignalBinding.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
| exists | boolean |
<optional> |
false |
We only need to know if there are handlers. |
| Type | Description |
|---|---|
| Array<PIXI.SignalBinding> | boolean |
Array of attached SignalBinding or Boolean if called with exists = true |
has(node: PIXI.SignalBinding) → {boolean}
Return true if node is a SignalBinding attached to this MiniSignal
| Name | Type | Description |
|---|---|---|
| node | PIXI.SignalBinding |
Node to check. |
| Type | Description |
|---|---|
| boolean |
True if node is attache to mini-signal |
once(fn: Function, thisArg: object) → {PIXI.SignalBinding}
Register a new listener that will be executed only once.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
| fn | Function |
Callback function. |
||
| thisArg | object |
<optional> |
undefined |
The context of the callback function. |
| Type | Description |
|---|---|
| PIXI.SignalBinding |
The SignalBinding node that was added. |