GODPAPER | All Packages | All Classes | Index | Frames No Frames |
Slot

Package | org.osflash.signals
Class | public class Slot
Inheritance | Slot Object
Implements | ISlot

The Slot class represents a signal slot.

Public Properties

| Property | Defined By
--- | --- | ---
|  | enabled : Boolean Whether the listener is called on execution. | Slot
|  | listener : Function The listener associated with this slot. | Slot
|  | once : Boolean [read-only] Whether this slot is automatically removed after it has been used once. | Slot
|  | params : Array Allows the ISlot to inject parameters when dispatching. | Slot
|  | priority : int [read-only] The priority of this slot should be given in the execution order. | Slot

Protected Properties

| Property | Defined By
--- | --- | ---
|  | _enabled : Boolean = true | Slot
|  | _listener : Function | Slot
|  | _once : Boolean = false | Slot
|  | _params : Array | Slot
|  | _priority : int = 0 | Slot
|  | _signal : IOnceSignal | Slot

Public Methods

| Method | Defined By
--- | --- | ---
|  | Slot(listener:Function, signal:IOnceSignal, once:Boolean = false, priority:int = 0) Creates and returns a new Slot object. | Slot
|  | execute(valueObjects:Array):void Executes a listener of arity n where n is valueObjects.length. | Slot
|  | execute0():void Executes a listener without arguments. | Slot
|  | execute1(value:Object):void Dispatches one argument to a listener. | Slot
|  | remove():void Removes the slot from its signal. | Slot
|  | toString():String Creates and returns the string representation of the current object. | Slot

Protected Methods

| Method | Defined By
--- | --- | ---
|  | verifyListener(listener:Function):void | Slot

Property Detail

_enabled | property

`protected var _enabled:Boolean = true`

_listener | property |

`protected var _listener:Function`

_once | property |

`protected var _once:Boolean = false`

_params | property |

`protected var _params:Array`

_priority | property |

`protected var _priority:int = 0`

_signal | property |

`protected var _signal:IOnceSignal`

enabled | property |

`enabled:Boolean`

Whether the listener is called on execution. Defaults to true.

Implementation
`public function get enabled():Boolean`
`public function set enabled(value:Boolean):void`

listener | property |

`listener:Function`

The listener associated with this slot.

Implementation
`public function get listener():Function`
`public function set listener(value:Function):void`
Throws

| `ArgumentError` — `ArgumentError`: Given listener is `null`. Did you want to set enabled to false instead?
| `Error` — `Error`: Internal signal reference has not been set yet.

once | property |

`once:Boolean` [read-only]

Whether this slot is automatically removed after it has been used once.

Implementation
`public function get once():Boolean`

params | property |

`params:Array`

Allows the ISlot to inject parameters when dispatching. The params will be at the tail of the arguments and the ISignal arguments will be at the head. var signal:ISignal = new Signal(String); signal.add(handler).params = [42]; signal.dispatch('The Answer'); function handler(name:String, num:int):void{}

Implementation
`public function get params():Array`
`public function set params(value:Array):void`

priority | property |

`priority:int` [read-only]

The priority of this slot should be given in the execution order. An IPrioritySignal will call higher numbers before lower ones. Defaults to 0.

Implementation
`public function get priority():int`
Constructor Detail

Slot | () | Constructor

`public function Slot(listener:Function, signal:IOnceSignal, once:Boolean = false, priority:int = 0)`

Creates and returns a new Slot object.

Parameters

| `listener:Function` — The listener associated with the slot.
| `signal:IOnceSignal` — The signal associated with the slot.
| `once:Boolean` (default = `false`)`` — Whether or not the listener should be executed only once.
| `priority:int` (default = `0`)`` — The priority of the slot.

Throws

| `ArgumentError` — `ArgumentError`: Given listener is `null`.
| `Error` — `Error`: Internal signal reference has not been set yet.

Method Detail

execute | () | method

`public function execute(valueObjects:Array):void`

Executes a listener of arity `n` where `n` is `valueObjects.length`. Existing `params` are appended before the listener is called.

Parameters

| `valueObjects:Array` — The array of arguments to be applied to the listener.

execute0 | () | method |

`public function execute0():void`

Executes a listener without arguments. Existing `params` are appended before the listener is called.

execute1 | () | method |

`public function execute1(value:Object):void`

Dispatches one argument to a listener. Existing `params` are appended before the listener is called.

Parameters

| `value:Object` — The argument for the listener.

remove | () | method |

`public function remove():void`

Removes the slot from its signal.

toString | () | method |

`public function toString():String`

Creates and returns the string representation of the current object.

Returns

| `String` — The string representation of the current object.

verifyListener | () | method |

`protected function verifyListener(listener:Function):void`

Parameters

| `listener:Function`

Thu Jan 16 2014, 01:11 PM +08:00