#Robotlegs 2 Beta 6 released

Yesterday we released Beta 6 of Robotlegs 2. Behind the scenes lots of improvements were made, aimed primarily at extension developers. But we also reintroduced some things and added a few minor functionalities:

Direct Command Map

The Direct Command Map allows you to execute commands directly and to pin and release commands in/from memory.

Command (sequence) execution

[Inject]
public var directCommandMap:IDirectCommandMap;

directCommandMap
    .map(CalculateAnswerToLifeTheUniverseAndEverythingCommand)
        .withGuards(DeepThoughtBuiltGuard)
        .withHooks(StartAnnouncementCeremonyHook)
    .map(BuildEarthCommand)
        .withGuards(WeDontKnowTheQuestionGuard)
        .withHooks(AlertTheMiceHook)
    .execute();

Command instance detainment and release from memory

[Inject]
public var directCommandMap : IDirectCommandMap;

[Inject]
public var importantService : IImportantService;

public function execute():void
{
    directCommandMap.detain(this);
    importantService.doSomethingImportant(onServiceCallComplete);
}

private function onServiceCallComplete():void
{
    directCommandMap.release(this);
}

Find out more

The readme provides a full explanation on what you can do with the Direct Command Map

Execute method parameters

Payload values are injected by default, but they can also be passed to the execute method of your commands.

By the Event Command Map

//ControllerConfig.as
eventCommandMap.map( FooEvent.FOO, FooEvent)
    .toCommand( FooCommand );

//FooCommand.as
public function execute( event : FooEvent ) : void{
    //do something with `event`
}

By the Direct Command Map

const payload : CommandPayload = new CommandPayload();
payload.addPayload(new Adieu('So long and thanks for all the fish!'), Adieu);

directCommandMap
    .map(ExtractDolphinsCommand)
    .execute(payload);

//ExtractDolphinsCommand
public function execute( adieu:Adieu ) : void{
    trace(adieu.toString());
}

This only applies to payload values! At the moment these are either events mapped to the EventCommandMap or manually populated CommandPayload values. Values/classes mapped to the injector are NOT passed to the execute-method.

Another small change

Event instances aren’t mapped to the abstract Event class by default anymore.
You’ll have to map them explicitly to Event in the Event Command Map:

eventCommandMap.map(FooEvent.FOO, Event) //<-- explicit mapping to `Event`
    .toCommand(FooCommand);

//FooCommand
[Inject]
public var event:Event;

So, what’s next?

There’s a few other changes I’m not going to dwell on yet, since they were made to facilitate some new functionalities we have planned. We have a few ideas we’re working on and experimenting with, that look very promising. Fact is that we’ll broaden the boundaries of commands a little to allow for faster setups and accomodate different coding styles.

More coming (very) soon…

Advertisements
    • Stephan
    • May 24th, 2013

    so when do you believe “soon” is?
    1 week?, 1 month? or 3 month?

    I have a working app that has been created with Robolegs 1.5 We are now begining on a new large app where 5 frontend developers will work on it for the next 2 month. Is it to early to switch to Robolegs 2.0 or should we stick with the old?

    rgds

    Stephan

    • I’d definitely recommend switching to 2.0
      Most changes we’re implementing are either additions or behind-the-scenes optimizations.
      And should issues/questions arise, we’ll try to help you out as soon as possible.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: