[Laszlo-dev] delegates *must* have an argument?

Antun Karlovac antun at laszlosystems.com
Thu Mar 19 12:07:52 PDT 2009


Yeah, you have to have one argument now for methods that get called by 
delegates. It's annoying. Happened in 4.1 
(http://www.antunkarlovac.com/blog/2008/07/02/migrating-lzx-code-to-openlaszlo-41/ 
).

I wonder if the arguments should be documented if they're only there for 
the purpose of avoiding the compiler warning? (e.g. when you write 
args="arg").

-Antun

Sarah Allen wrote:
> So, I've got this code...
> 
>     <method name="_activateTimeDel">
>         //Debug.write("mediastream._activeTimeDel()", this);
>         if (!this._timedel) {
>             this._timedel = new LzDelegate(this, "_updateTime");
>         }
> 
>         this._timedel.unregisterAll();
>         this._timedel.register(lz.Idle, "onidle");
>     </method>
> 
> I had noticed that _updateTime had an unused (and undocumented) argument 
> 'v' which I removed to make the code cleaner and clearer.  However, in 
> the swf9 runtime, I learn that delegates *must* be declared with an 
> argument:
> WARNING: Invalid delegate: mediastream name: ms._updateTime => Function 
> (must accept one argument)
> 
> So, I go look up in the reference to see what the argument is and find 
> no mention of it.  Is this a doc omission?
> 
> just curious... for now, I'll just put back the mysterious 'v'
> 
> Sarah


More information about the Laszlo-dev mailing list