Skip to content

Latest commit

 

History

History
37 lines (21 loc) · 1.64 KB

readme.markdown

File metadata and controls

37 lines (21 loc) · 1.64 KB

About

This fork is a quick and dirty edit of Joel Hooks' original signals-extension-CommandSignal that allows the signal arguments to be passed into the execute() method as parameters instead of being injected into the command. This allows signals to trigger commands with multiple parameters of the same type, and also allows optional arguments.

Disclaimer

The code needs some unit tests, and support for GuardedSignals needs to be added. I will get round to doing this at some point, or if anyone else would like to contribute these bits please feel free!

Usage

To make use of this functionality your command needs to extend SignalArgumentsCommand and implement an execute() method:

// The command class
public class MyCommand extends SignalArgumentsCommand {

   [Inject] 
   public var myModel:MyModel;

   public function execute(param1:String, param2:String, param3:Boolean):void {
   }

 }

// The signal
var executeMyCommandSignal:Signal = new Signal(String, String, Boolean);

Note that if the command doesn't extend SignalArgumentsCommand the parameters will get injected as usual.

Many thanks to Michael Cann who came up with the idea in this thread

SignalCommandMap

The SignalCommandMap is an extension for the Robotlegs-AS3 micro-architecture that makes use of AS3-Signals to trigger commands.

Requires Robotlegs 1.1

Here is an example and more details