PureMVC to RobotLegs part 2...Notifications in Mediators

jbach's Avatar

jbach

23 Mar, 2010 01:58 AM

So in RL there are no Notifications, and instead every framework member has a 'eventDispatcher' property that you listen for in your Mediators.

Would the following then be correct in converting PureMVC Mediator code to its equivalent in RobotLegs? Obviously I will need to create a 'INITIALIZE_SITE' constant on the custom event 'SomeEvent'.

//START PUREMVC CODE

override public function listNotificationInterests():Array
    {
        return [Constants.INITIALIZE_SITE];
    }

override public function handleNotification(note:INotification):void
    {
        switch (note.getName())
         {
            case Constants.INITIALIZE_SITE:
            frameworkEventHandler(note.getBody());
            break;
            }
    }

//END PUREMVC CODE

//START ROBOTLEGS
{
override public function onRegister():void
    {
eventMap.mapListener(eventDispatcher, SomeEvent.INITIALIZE_SITE, frameworkEventHandler)
        }
}
//END ROBOTLEGS
  1. 1 Posted by Jonny Reeves on 23 Mar, 2010 11:05 AM

    Jonny Reeves's Avatar

    Yep ;)

  2. Shaun Smith closed this discussion on 20 Jun, 2010 04:23 PM.

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

Keyboard shortcuts

Generic

? 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