8 Jul 2007
(updated 21 Aug 2007 at 14:12 UTC) »
Idempotent transactions are ones which may be repeated without affecting anything. You may have heard of this term when it comes to online banking ,where idempotent transactions are required ,and basically care needs to be taken to rollback , and not accidently charge twice for the same purchase .
Let us assume that you dynamically add an event to an object . Now with Reusable.DeferredEvent , it throws a similiar api , gives you an option to specify your existing addEvent code -.Popular version of which are :
Which means for configure listenEvent event
for every listenTill seconds
, for any listenObj
object .In the demos , you will find two scenarios :
Demo and Code here .
- Only unique button click's on Button1 in the range of 1 seconds will be recognised !
- Only unique mouseouts on Button2 in the range of 3 second will be be recognised.
//@param name of instance
//instantName = new Reusable.IdempotentEvent(instantName);
// Step 1 : Instantiation
responsive = new Reusable.IdempotentEvent('responsive');
//@param listenObj - DOM listenTillelement or element id
//@param listenEvent string - Event name (as per your toolkit nomenclature )
//@param listenTill int / string - how frequency to accept event triggers
//@param callBack string - What function to callback eventually
// Step 2 : Exeuction
//responsive.register( listenObj , listenEvent , listenTill , callBack );
responsive.register( btn1, 'click' , btn1.getAttribute('onclickwhen'), 'clicked' );
responsive.register( btn1, 'mouseout' , 1000, 'hovered' );
Syndicated 2007-02-15 03:55:00 (Updated 2007-02-21 08:10:01) from Bosky says........the web log of Bhasker V K