📜  settimerout 在刷新浏览器后被抛出 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:26.988000             🧑  作者: Mango

代码示例1
setTimeout(function() {
    get_details(user);
}, 18000);


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.