Event Handler in Laszlo

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. 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值