[Dojo-interest] Dojo equivalent to clear timeout

Jishnu R jishnu.kkd at gmail.com
Tue Jun 1 11:15:40 EDT 2010


Thank you very much Peter. Let me go through the link.

Thanks & Regards,
Jishnu

On Mon, May 31, 2010 at 7:44 PM, Peter Higgins <dante at dojotoolkit.org>wrote:

>
> Nope, this is precisely how you'd do it. I wrote a function to wrap this
> pattern a bit:
>
> http://dojocampus.org/content/2009/09/28/rate-limiting-with-javascript/
>
> The only change(s) I'd make to your code:
>
> timeoutid && clearTimeout(timeoutid); // ensure it exists first. totally
> not necessary but arguably faster
>
> setTimeout(clickButton, 500); // not: setTimeout('clickButton()', 500),
> which uses eval underthecovers.
>
> Regards,
> Peter
>
> Jishnu R wrote:
> > Dear All,
> > Is there any equivalent to JavaScript's clear timeout method. I've the
> > following code. I'm trying to implement an autocomplete text box in
> > JSF. When the user types some character an AJAX request is triggered
> > and the results are shown. Sometimes behavior is unpredictable. It
> > sometimes makes as many requests as the number of characters in the
> > text field. I would like to know if there is any better way of  doing
> > this in Dojo. We cannot use Dojo autocomplete widget.Can someone
> > please help me to fix this. This is a very urgent requirement. Please
> > help.
> >
> >  var timeouid=0;
> > //This method is called on keyup.
> >
> > function intitiateTypeAheadRequest(){
> >
> >                                                            try {
> >
> >
> > clearTimeout(timeoutid);
> >
> >                                                               if
> >
> (document.getElementById("view<%=renderResponse.getNamespace()%>:inputText").value.length
> > >= 2)
> > {
> > timeoutid = setTimeout('clickButton()',
> > 500);                                                            }
> >
> >                                                 }
> >
> >                                                 catch (e) {
> >
> >                                                 }
> >
> >                                                 return false;
> >
> >                                     }
> >
> > function clickButton(){
> >
> > clearTimeout(timeoutid);
> >
> > //CLick the button
> >
> > }
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > FAQ: http://dojotoolkit.org/support/faq
> > Book: http://docs.dojocampus.org
> > Dojo-interest at mail.dojotoolkit.org
> > http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
> >
>
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://docs.dojocampus.org
> Dojo-interest at mail.dojotoolkit.org
> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.dojotoolkit.org/pipermail/dojo-interest/attachments/20100601/6cae5699/attachment.htm 


More information about the Dojo-interest mailing list