/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

  1. package 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. * Allows the ISlot to inject parameters when dispatching. The params will be at
  19. * the tail of the arguments and the ISignal arguments will be at the head.
  20. *
  21. * var signal:ISignal = new Signal(String);
  22. * signal.add(handler).params = [42];
  23. * signal.dispatch('The Answer');
  24. * function handler(name:String, num:int):void{}
  25. */
  26. function get params():Array;
  27. function set params(value:Array):void;
  28. /**
  29. * Whether this slot is automatically removed after it has been used once.
  30. */
  31. function get once():Boolean;
  32. /**
  33. * The priority of this slot should be given in the execution order.
  34. * An IPrioritySignal will call higher numbers before lower ones.
  35. * Defaults to 0.
  36. */
  37. function get priority():int;
  38. /**
  39. * Whether the listener is called on execution. Defaults to true.
  40. */
  41. function get enabled():Boolean;
  42. function set enabled(value:Boolean):void;
  43. /**
  44. * Executes a listener without arguments.
  45. * Existing <code>params</code> are appended before the listener is called.
  46. */
  47. function execute0():void;
  48. /**
  49. * Dispatches one argument to a listener.
  50. * Existing <code>params</code> are appended before the listener is called.
  51. * @param value The argument for the listener.
  52. */
  53. function execute1(value:Object):void;
  54. /**
  55. * Executes a listener of arity <code>n</code> where <code>n</code> is
  56. * <code>valueObjects.length</code>.
  57. * Existing <code>params</code> are appended before the listener is called.
  58. * @param valueObjects The array of arguments to be applied to the listener.
  59. */
  60. function execute(valueObjects:Array):void;
  61. /**
  62. * Removes the slot from its signal.
  63. */
  64. function remove():void;
  65. }
  66. }