Hi Joel,
I was wondering if something like this would be feasible. Based on how the EventMap works, I've implemented a first draft of the mentioned above: Matan@1b773ee
The reason for this is because I'd like signal to automatically "unmap" once the view has been removed from stage. The EventMap has made me quite lazy towards clean up, so I'd like the same functionality, but with Signals. :)
Sample:
override protected function onRegister():void{
signalMap.add(view.onUpdate, update_handler);
}
protected function update_handler():void{
trace("View dispatched onUpdate");
}
This code the above is a bit redundant as the view will hopefully be cleaned up properly and reference to the signal and handler is lost once the Mediator and view are disposed. For good measure I always remove listeners added to the view signal manually. With SignalMap it won't be required any more as I should have piece of mind that it's been taken care of.
But, if you are listening to a shell Signal that's not disposed once the view is dispose the Mediator will linger in memory and thus the view.
[Inject]
public var userDataReadySignal:UserDataReadySignal;
override protected function onRegister():void{
signalMap.add(userDataReadySignal, dataReady_handler);
}
protected function dataReady_handler():void{
trace("Shell dispatched userDataReady");
}
Using the SignalMap in the case above doesn't require manual clean up.
Let me know what you think. :)
Thanks,
Matan