Delaying javascript function execution
<p>I am using jQuery(Latest release) and have a function called "calculate()" which gets called every time a field is edited and the field exited(blur etc). (To allow "dynamic" calculation")
The calculation takes under 4 seconds to complete, but if the user changes another element on the form before the calculation is complete, then they are queued and the function is called again after the current action is complete.
As I can't stop the function from processing once it's started, is it possible to delay the function by a couple of seconds and then each time a form element is interacted with, add to the timer.</p>

<p>I don't think this is possible, but thoguht i'd give it a shot.</p>

<p>I know I could do:
<code>setTimeout(function(){ ... }, 4000);</code>
but I would need a way to add to this timer. (i.e. The timer has 1 second left, I click on a field and I want the timer to go back to 4 seconds)</p>
