title: JavaScript getTimeout?
body: <p>The <a href="https://developer.mozilla.org/en/DOM/window.setTimeout" rel="noreferrer">window.setTimeout</a> (and related setInterval) function in Javascript allows you to schedule a function to be executed sometime in the future:</p>
  
  <pre><code>id = setTimeout(function, delay);
  </code></pre>
  
  <p>where "delay" is the number of milliseconds into the future at which you want to have the function called.  Before this time elapses, you can cancel the timer using:</p>
  
  <pre><code>clearTimeout(id);
  </code></pre>
  
  <p><b>What I want</b> is to <b>update</b> the timer.  I want to be able to advance or retard a timer so that the function gets called x milliseconds <i>sooner</i> or <i>later</i> than originally scheduled.</p>
  
  <p>If there were a getTimeout method, you could do something like:</p>
  
  <pre><code>originally_scheduled_time = getTimeout(id);
  updateTimeout(id, originally_schedule_time + new_delay);  // change the time
  </code></pre>
  
  <p>but as far as I can tell there's nothing like getTimeout or any way to update an existing timer.</p>
  
  <p><b>Is there a way to access the list of scheduled alarms and modify them?</b></p>
  
  <p><b>Is there a better approach?</b> </p>
  
  <p>thanks!</p>