Quantcast
Channel: Resetting a setTimeout - Stack Overflow
Browsing all 11 articles
Browse latest View live

Answer by Stalinko for Resetting a setTimeout

For NodeJS it's super simple:const timeout = setTimeout(...);timeout.refresh();From the docs:timeout.refresh()Sets the timer's start time to the current time, and reschedules the timer to call its...

View Article



Answer by Clint for Resetting a setTimeout

i know this is an old thread but i came up with this todayvar timer = []; //creates a empty array called timer to store timer instancesvar afterTimer = function(timerName, interval, callback){...

View Article

Answer by Biskrem Muhammad for Resetting a setTimeout

var redirectionDelay;function startRedirectionDelay(){ redirectionDelay = setTimeout(redirect, 115000);}function resetRedirectionDelay(){ clearTimeout(redirectionDelay);}function redirect(){...

View Article

Answer by Anwasi Richard Chibueze for Resetting a setTimeout

To reset the timer, you would need to set and clear out the timer variable$time_out_handle = 0;window.clearTimeout($time_out_handle);$time_out_handle = window.setTimeout( function(){---}, 60000 );

View Article

Answer by kaleazy for Resetting a setTimeout

This timer will fire a "Hello" alertbox after 30 seconds. However, everytime you click the reset timer button it clears the timerHandle then re-sets it again. Once it's fired, the game ends.<script...

View Article


Answer by andres descalzo for Resetting a setTimeout

$(function() { (function(){ var pthis = this; this.mseg = 115000; this.href = 'file.php' this.setTimer = function() { return (window.setTimeout( function() {window.location.href = this.href;},...

View Article

Answer by Frank Krueger for Resetting a setTimeout

You will have to remember the timeout "Timer", cancel it, then restart it:g_timer = null;$(document).ready(function() { startTimer();});function startTimer() { g_timer = window.setTimeout(function() {...

View Article

Answer by bdukes for Resetting a setTimeout

You can store a reference to that timeout, and then call clearTimeout on that reference.// in the example above, assign the resultvar timeoutHandle = window.setTimeout(...);// in your click function,...

View Article


Answer by Deniz Dogan for Resetting a setTimeout

var myTimer = setTimeout(..., 115000);something.click(function () { clearTimeout(myTimer); myTimer = setTimeout(..., 115000);}); Something along those lines!

View Article


Answer by meder omuraliev for Resetting a setTimeout

clearTimeout() and feed the reference of the setTimeout, which will be a number. Then re-invoke it:var initial;function invocation() { alert('invoked') initial = window.setTimeout( function() {...

View Article

Resetting a setTimeout

I have the following:window.setTimeout(function() { window.location.href = 'file.php';}, 115000);How can I, via a .click function, reset the counter midway through the countdown?

View Article
Browsing all 11 articles
Browse latest View live




Latest Images