[dojo-contributors] Generalized Frequency Checker class

Tom Trenka ttrenka at gmail.com
Mon Jun 26 10:46:18 EDT 2006

timer is a bad name for this; there is already a Timer class in the
Dojo repo (under animation)...


On 6/26/06, LiuCougar <liucougar at gmail.com> 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
> --
> "People's characters are strengthened through struggle against
> difficulties; they are weakened by comfort."
> - Old Chinese adage
> _______________________________________________
> dojo-contributors mailing list
> dojo-contributors at dojotoolkit.org
> http://dojotoolkit.org/mailman/listinfo/dojo-contributors

More information about the dojo-contributors mailing list