Signals in Model classes - are Actors redundant?

Marc's Avatar


31 May, 2012 04:40 AM

I'm unsure what the best implementation of signals is in my model.

Currently I have something like this:

public class Model 
    public var updated:Signal;

public class ViewMediator extends Mediator 
    public var model : Model;

    public var view : View;

    public function init() : void 

    private function updateView() : void 


This approach seems reasonable but doesn't take advantage of the event bus mapping. In short, my model no longer needs to extend Actor, this seems wrong to me.

What would be the standard implementation if I want to use Signals over Events?

  1. Support Staff 1 Posted by creynders on 31 May, 2012 08:02 AM

    creynders's Avatar

    Models are not required to extend Actor, it (the Actor class) is there for convenience when using events for system messaging.

    In general I use signals for view -> mediator and direct service -> command (or mediator) communication (ie. a command calls a method on a service and receives a signal it can listen to for completion notification) and rely on events for all other system messaging, but everyones tastes and needs are different, so you'll have to experiment a little to find out what works best for you.

  2. 2 Posted by Stray on 31 May, 2012 11:19 AM

    Stray's Avatar

    There's also the SignalMap / SignalMediator classes, which will give you automatic unmapping when your mediator is destroyed - otherwise you need to override onRemove and make sure you're removing those handlers so they don't linger around and cause memory leaks and double-handler bugs.



  3. Ondina D.F. closed this discussion on 13 Jul, 2012 07:04 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac