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
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. |
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. |
Detach all listeners.
Returns:
Type | Description |
---|---|
Signal | The instance on which this method was called. |
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
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 |
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
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. |