Created
February 12, 2010 16:16
-
-
Save darscan/302698 to your computer and use it in GitHub Desktop.
An Async Command for Robotlegs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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