Would you mind posting a link to your timer plugin?

If I'm going to use an external function I will need to pass additional
parameters.  How do you force passing the event type along with extra data? 
I'm newish to javascript...



Blair Mitchelmore-2 wrote:
> 
> It might be better if you didn't use an anonymous function so you could 
> reference it multiple times. (I'm going to use a plugin I wrote that 
> jQuerizizes timer events cause it really simplifies the syntax of the 
> solution but something equivalent could be done without it.)
> 
> Example:
> var fn = function(e) {
>     if (e.type == 'blur') $(this).stop();
>     // Do stuff
> }
> $(whatever).blur(fn).keyup(function() {
>     $(this).once(2000,fn);
> }).keydown(function() {
>     $(this).stop();
> });
> 
> Hope that helps.
> 
> -blair
> 
> Daemach wrote:
>> I have a form with which I want to do ajax updates as they type.  If they
>> stop typing for more than 2 seconds it should update the field.  If the
>> field blurs before the 2 seconds are up it should update the field.  
>>
>> I have the ajax side of it worked out, and currently the updates work
>> properly when the field blurs.  I just need some ideas on how to write
>> the
>> timer function for the keypresses and how it integrates with the blur
>> function so the function doesn't get called twice and so there are no
>> memory
>> leaks from timers set then abandoned because the blur event got to it
>> first.
>>
>> I'm going for elegance here :)  I could write an outside function that
>> gets
>> called from both event handlers but that seems cheezy.  There must be a
>> way
>> to do this with an anonymous function...
> 
> 
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Gmail-style-updates-tf3269331.html#a9091920
Sent from the JQuery mailing list archive at Nabble.com.


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to