Of course, this code doesn't have any reason to be a jQuery plugin at all.
It could just be:

    function expire( callback, interval ) {
        var timer;
        return function() {
            clearTimeout( timer );
            timer = setTimeout( callback, interval );
        };
    }

with the calling code being:

        $("input").keyup( expire( function(){
                updateField( $(this) );
        }, 6000 ) );

-Mike

> For this particular task, a simpler version of the plugin 
> would also do the trick:
> 
> (function( $ ) {
>     $.expire1 = function( callback, interval ) {
>         var timer;
>         return function() {
>             clearTimeout( timer );
>             timer = setTimeout( callback, interval );
>         };
>     };
> })( jQuery );
> 
> with your code being:
> 
>       $("input").keyup( $.expire1( function(){
>               updateField( $(this) );
>       }, 6000 ) );

Reply via email to