[Arp] Passing data to commands

Aral Balkan aral at ariaware.com
Mon Jan 10 10:16:01 PST 2005


Hi Darron,

First off, welcome to the list! :)

> Looking at the framework, I think the ControllerTemplate should call 
> theCommand.execute() and pass in the entire eventObj, rather than just 
> passing in eventObj.target as a reference to the view.  That way, you 
> can attach more data for the command to process.. like
>
> dispatchEvent({type:"emailError", target:this, data:"This is my error 
> message"}); 

I agree. And we can still save a reference to ViewRef so existing code 
will not be broken (unless it wasn't using the CommandTemplate and was 
expecting the old behavior from the Controller.

> the constructor is wrong... it should be function CommandTemplate 
> instead of function Command,

Noted. Will be fixing this in the next release.

> I'd also like to vote for to add an Event class as well, with 3 public 
> properties - type, target, and data --   dispatchEvent(new 
> Event("emailError", this, "This is my error message")) looks nicer 
> than using an anonymous object.

Again, sounds good to me.

How about making it more flexible? Event ( type, target, arg1, arg2, argN )?

Aral




More information about the Arp mailing list