Skip to content

Instantly share code, notes, and snippets.

@darscan
Created February 12, 2010 16:16
Show Gist options
  • Save darscan/302698 to your computer and use it in GitHub Desktop.
Save darscan/302698 to your computer and use it in GitHub Desktop.
An Async Command for Robotlegs
package org.robotlegs.extensions.mvcs
{
import flash.utils.Dictionary;
import org.robotlegs.base.EventMap;
import org.robotlegs.core.IEventMap;
import org.robotlegs.mvcs.Command;
public class AsyncCommand extends Command
{
protected static var _commands:Dictionary = new Dictionary();
protected var _eventMap:IEventMap;
public function AsyncCommand()
{
_commands[this] = true;
}
public function finish():void
{
if (_eventMap) _eventMap.unmapListeners();
delete _commands[this];
}
protected function fork(commandClass:Class):void
{
injector.instantiate(commandClass).execute();
}
protected function get eventMap():IEventMap
{
return _eventMap || (_eventMap = new EventMap(eventDispatcher));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment