new SignalBinding(signal, listener, isOnce, listenerContext, priority)
Object that represents a binding between a Signal and a listener function. This is an internal constructor and shouldn't be created directly. Inspired by Joa Ebert AS3 SignalBinding and Robert Penner's Slot classes.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
signal |
Phaser.Signal | Reference to Signal object that listener is currently bound to. |
|
listener |
function | Handler function bound to the signal. |
|
isOnce |
boolean | If binding should be executed just once. |
|
listenerContext |
object |
<optional> |
Context on which listener will be executed (object that should represent the |
priority |
number |
<optional> |
The priority level of the event listener. (default = 0). |
- Source:
Members
-
active
-
If binding is active and should be executed.
- Default Value:
- true
- Source:
Properties:
Name Type Description active
boolean -
context
-
- Source:
Properties:
Name Type Description context
object | undefined | null Context on which listener will be executed (object that should represent the
this
variable inside listener function). -
params
-
Default parameters passed to listener during
Signal.dispatch
andSignalBinding.execute
(curried parameters).- Default Value:
- null
- Source:
Properties:
Name Type Description params
array | null
Methods
-
detach() → {function|null}
-
Detach binding from signal. alias to: @see mySignal.remove(myBinding.getListener());
- Source:
Returns:
Handler function bound to the signal or
null
if binding was previously detached.- Type
- function | null
-
execute(paramsArr) → {any}
-
Call listener passing arbitrary parameters. If binding was added using
Signal.addOnce()
it will be automatically removed from signal dispatch queue, this method is used internally for the signal dispatch.Parameters:
Name Type Argument Description paramsArr
array <optional>
Array of parameters that should be passed to the listener.
- Source:
Returns:
Value returned by the listener.
- Type
- any
-
getListener() → {function}
-
- Source:
Returns:
Handler function bound to the signal.
- Type
- function
-
getSignal() → {Phaser.Signal}
-
- Source:
Returns:
Signal that listener is currently bound to.
- Type
- Phaser.Signal
-
isBound() → {boolean}
-
- Source:
Returns:
True if binding is still bound to the signal and has a listener.
- Type
- boolean
-
isOnce() → {boolean}
-
- Source:
Returns:
If SignalBinding will only be executed once.
- Type
- boolean
-
toString() → {string}
-
- Source:
Returns:
String representation of the object.
- Type
- string