I was trying to use the new event tag, and got confused, so I wrote this simple test case:

<canvas>
   <class name="foo">
       <event name="onstop"/>
       <method event="oninit">
           Debug.write('onstop', this.onstop);
           if (this.onstop) Debug.write('if (this.onstop)');
if (this.onstop == null) Debug.write('if (this.onstop == null)');
       </method>
   </class>

   <foo/>
</canvas>

I had hoped that this.onstop would be null, and expected it to be at least undefined. I was surprised by this debugger output:
onstop «¡LzEvent!#1| «foo#0».onstop»
if (this.onstop)

The currently implementation seems to be in no way equivalent to the previous convention of:
   <attribute name="onstop" value="null"/>
since it will end up always calling sendEvent when the code later does something like:
  if (this.onstop) this.onstop.sendEvent()

We started this convention just to avoid debugger warnings. This improvement should not cause the same code to incur the cost of an extra method call. or am I missing something?

Sarah

_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev

Reply via email to