PageRenderTime 26ms CodeModel.GetById 16ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/src/org/osflash/signals/ISlot.as

http://github.com/robertpenner/as3-signals
ActionScript | 74 lines | 18 code | 8 blank | 48 comment | 0 complexity | b6d0b2866842c5c31d1895190aa7a4c4 MD5 | raw file
 1package org.osflash.signals
 2{
 3	/**
 4	 * The ISlot interface defines the basic properties of a
 5	 * listener associated with a Signal.
 6	 *
 7	 * @author Joa Ebert
 8	 * @author Robert Penner
 9	 */
10	public interface ISlot
11	{
12		/**
13		 * The listener associated with this slot.
14		 */
15		function get listener():Function;
16		function set listener(value:Function):void;
17		
18		/**
19		 * Allows the ISlot to inject parameters when dispatching. The params will be at 
20		 * the tail of the arguments and the ISignal arguments will be at the head.
21		 * 
22		 * var signal:ISignal = new Signal(String);
23		 * signal.add(handler).params = [42];
24		 * signal.dispatch('The Answer');
25		 * function handler(name:String, num:int):void{}
26		 */
27		function get params():Array;
28		function set params(value:Array):void;
29
30		/**
31		 * Whether this slot is automatically removed after it has been used once.
32		 */
33		function get once():Boolean;
34
35		/**
36		 * The priority of this slot should be given in the execution order.
37		 * An IPrioritySignal will call higher numbers before lower ones.
38		 * Defaults to 0.
39		 */
40		function get priority():int;
41		
42		/**
43		 * Whether the listener is called on execution. Defaults to true.
44		 */
45		function get enabled():Boolean;
46		function set enabled(value:Boolean):void;
47		
48		/**
49		 * Executes a listener without arguments.
50		 * Existing <code>params</code> are appended before the listener is called.
51		 */
52		function execute0():void;		
53
54		/**
55		 * Dispatches one argument to a listener.
56		 * Existing <code>params</code> are appended before the listener is called.
57		 * @param value The argument for the listener.
58		 */
59		function execute1(value:Object):void;		
60
61		/**
62		 * Executes a listener of arity <code>n</code> where <code>n</code> is
63		 * <code>valueObjects.length</code>.
64		 * Existing <code>params</code> are appended before the listener is called.
65		 * @param valueObjects The array of arguments to be applied to the listener.
66		 */
67		function execute(valueObjects:Array):void;
68		
69		/**
70		 * Removes the slot from its signal.
71		 */
72		function remove():void;
73	}
74}