# Class: SignalBinding

## Phaser. SignalBinding

Object that represents a binding between a Signal and a listener function. This is an internal constructor and shouldn't be called by regular users. Inspired by Joa Ebert AS3 SignalBinding and Robert Penner's Slot classes.

#### new SignalBinding(signal, listener, isOnce, listenerContext, priority)

  ##### 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 `this` variable inside listener function).
  `priority` | number | <optional> | The priority level of the event listener. (default = 0).

  Author:
    - Miller Medeiros http://millermedeiros.github.com/js-signals/
  Source:
    - core/SignalBinding.js, line 21

### Members

#### active

  If binding is active and should be executed.

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `active` | boolean |

  Default Value:
    - true
  Source:
    - core/SignalBinding.js, line 61

#### context

  ##### 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).

  Source:
    - core/SignalBinding.js, line 38

#### params

  Default parameters passed to listener during `Signal.dispatch` and `SignalBinding.execute` (curried parameters).

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `params` | array | null |

  Default Value:
    - null
  Source:
    - core/SignalBinding.js, line 68

### Methods

#### detach() → {function|null}

  Detach binding from signal. alias to: @see mySignal.remove(myBinding.getListener());

  Source:
    - core/SignalBinding.js, line 96

  ##### 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:
    - core/SignalBinding.js, line 70

  ##### Returns:

  Value returned by the listener.

  Type
    any

#### getListener() → {function}

  Source:
    - core/SignalBinding.js, line 122

  ##### Returns:

  Handler function bound to the signal.

  Type
    function

#### getSignal() → {Signal}

  Source:
    - core/SignalBinding.js, line 130

  ##### Returns:

  Signal that listener is currently bound to.

  Type
    Signal

#### isBound() → {boolean}

  Source:
    - core/SignalBinding.js, line 106

  ##### Returns:

  True if binding is still bound to the signal and has a listener.

  Type
    boolean

#### isOnce() → {boolean}

  Source:
    - core/SignalBinding.js, line 114

  ##### Returns:

  If SignalBinding will only be executed once.

  Type
    boolean

#### toString() → {string}

  Source:
    - core/SignalBinding.js, line 149

  ##### Returns:

  String representation of the object.

  Type
    string