[dojo-contributors] Generalized Frequency Checker class

Alex Russell alex at dojotoolkit.org
Mon Jun 26 11:58:01 EDT 2006


Seconded.

It would seem best to reuse our existing rate limiting code unless 
there's a compelling reason to wrap a function in-place, in which case 
we should probably just be extending lang.hitch() or something.

Regards

On Monday 26 June 2006 12:10 am, Bill Keese wrote:
> 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
>
> _______________________________________________
> dojo-contributors mailing list
> dojo-contributors at dojotoolkit.org
> http://dojotoolkit.org/mailman/listinfo/dojo-contributors

-- 
Alex Russell
alex at dojotoolkit.org BE03 E88D EABB 2116 CC49 8259 CF78 E242 59C3 9723
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
Url : http://mail.dojotoolkit.org/pipermail/dojo-contributors/attachments/20060626/c3d28480/attachment.sig 


More information about the dojo-contributors mailing list