[dojo-contributors] Generalized Frequency Checker class

Dustin Machi dmachi at dojotoolkit.org
Mon Jun 26 13:21:46 EDT 2006


http://archive.dojotoolkit.org/nightly/tests/event/test_rate_limited_events.html

dustin


LiuCougar wrote:
> could some one direct me to the document about the "rate" feature in
> dojo.event.connect?
> 
> On 6/26/06, Alex Russell <alex at dojotoolkit.org> wrote:
>> 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.
> So what do you think the syntax should be for the generalized
> frequency checker class?
> 
> thanks,
> Heng
> 
>> 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
>>
>>
>> _______________________________________________
>> dojo-contributors mailing list
>> dojo-contributors at dojotoolkit.org
>> http://dojotoolkit.org/mailman/listinfo/dojo-contributors
>>
>>
>>
>>
> 
> 



More information about the dojo-contributors mailing list