Created
July 16, 2021 01:35
-
-
Save chabibnr/83812751820fb20963cea11c4c58a436 to your computer and use it in GitHub Desktop.
Autoreload in time
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function AutoReload(times){ | |
setInterval(function (){ | |
let now = new Date(); | |
let hour = (now.getHours() < 10 ? '0' : '')+now.getHours(); | |
let minute = (now.getMinutes() < 10 ? '0':'' )+now.getMinutes(); | |
let second = (now.getSeconds() < 10?'0':'') + now.getSeconds(); | |
if(times.indexOf(`${hour}:${minute}:${second}`) != -1){ | |
window.location.reload(); | |
} | |
}, 1000); | |
} | |
AutoReload([ | |
'08:33:10', | |
'08:33:20', | |
'08:33:30' | |
]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment