[dojo-contributors] Generalized Frequency Checker class

Bill Keese bill at dojotoolkit.org
Mon Jun 26 03:10:14 EDT 2006

How is this different than the "rate" argument to dojo.event.connect?

LiuCougar wrote:
> Hi all,
> I noticed a comment in Editor2.js for a generalized Frequency Checker
> class. Attached is the patch containing the class I implemented and
> the patch to let Editor2 make use of it.
> At the moment, the class is named dojo.timer, I am not happy with it
> at all, I think a better name is needed. In addition, for simplicity,
> I included this class in Editor2.js. I'd also like to hear, if you
> guys like this class, then which package should this be placed?
> Some more explanation about this class dojo.timer:
> it can wrap a member function in an object to ensure that it does not
> called so frequently.
> How to use it:
> you have an object and one of its member function expensiveFunction is
> expensive to run, so you use dojo.timer to "protect" it like this:
> object.timer = new dojo.timer();
> object.timer.wrap(object, "expensiveFunction");
> the frequency can be configured as well
> (see the patch for a real use case)
> Another possible use case for this class is to prevent the
> placeDialog() in Dialog widget is called too frequently (when using
> wheel in the mouse to scroll, lots of onScroll events are generated
> quite quickly)
> what do you think?
> Regards,
> Heng
> ------------------------------------------------------------------------
> _______________________________________________
> dojo-contributors mailing list
> dojo-contributors at dojotoolkit.org
> http://dojotoolkit.org/mailman/listinfo/dojo-contributors

More information about the dojo-contributors mailing list