CodePudding user response:
Do not refresh the page can judge that time, recording the time of the day before and then judge the current time is greater than the execution time 24 hours timer, refresh the page each time the timer to go,
Var time=new Date (' 2020-08-19 ')
If (Date. Now () - time & gt; 86400000) {
//execution timers
}
CodePudding user response:
The third, fourth, fifth,,, many days later, the user may have been hungCodePudding user response:
When removing the timer record the date and then walk a timer for the current date when two different dates again after wake up wake up before the timer clear behind this timerCodePudding user response:
More than 24 hours the time not at the same time!!!!!!!!!!!CodePudding user response:
SetInterval, 5 minutes at a time always executeTwo global variables: the last execution date (format YYYYMMDD), number of executions
The callback function:
First to get the current date, and the last is the implementation date, if the same, and the number is less than 5, execute the business logic, execution times + 1
If not the same, the number is set to 0, the execution date set to the current date, execute the business logic, execution times + 1