I have script like below.
if i refresh a page before (3 Minutes)setTimeout
, get_details function call will work or not?
setTimeout(function() {
get_details(user);
}, 18000);
I have script like below.
if i refresh a page before (3 Minutes)setTimeout
, get_details function call will work or not?
setTimeout(function() {
get_details(user);
}, 18000);
Share
Improve this question
asked May 18, 2016 at 11:51
Raj_KingRaj_King
5563 silver badges13 bronze badges
2
- Yes it will work, after 3 mins of page reload – Satpal Commented May 18, 2016 at 11:53
- @Satpal Thanks for ur reply – Raj_King Commented May 18, 2016 at 11:59
2 Answers
Reset to default 5If you refresh while the timer is running it will start all over again when the page reloads.
So to answer your question, yes the get_details()
function will be called after the refresh but only after the full 3 minutes has elapsed since the refresh occurred.
It depends when you invoke the setTimeout:
- setTimeout invoked on dom ready - Yes, get_details() will run after 180 sec
- setTimout invoked on event (e.g. button click) - Button was clicked --> setTimeout has been invoked --> page was refreshed, the queue of the event loop was cleared and get_details will not be invoked.