Define an event, and associate a handler with the event. Both of them should share the same name.
<event name="AAA"> <handler name="AAA" args="a,b"></handler>
<attribute name="AA"..../> <handler name="onAA" args="a,b"/>
3. Check the existence of the handler
if (onAA || this['AAA'] ) AAA.sendEvent();
Listener/Handler/Event is the basic broadcast mechnanism in Laszlo. A source can have multiple listener/handler. They are notified peer-to-peer.
Be careful of the loop notification in handler.
4. // check the type and value is null or not
if (typeof this.time == "undefined" || this.time == null) { //handle first set of time
this.setAttribute("text", "first click registered");
}
if (ontime) this.ontime.sendEvent(); // send event when it is there.
5. In Lzx,event and delegate are defined in term of each other. An delegate is an object that calls a method.
An event is an object which stores the delegate.
6. var del = new lz.Delegate(obj, method-name, eventSender, event-name);
delegate需要自己先清理一下,防止内存泄漏。
7.