Skip to content

Instantly share code, notes, and snippets.

@chabibnr
Created July 16, 2021 01:35
Show Gist options
  • Save chabibnr/83812751820fb20963cea11c4c58a436 to your computer and use it in GitHub Desktop.
Save chabibnr/83812751820fb20963cea11c4c58a436 to your computer and use it in GitHub Desktop.
Autoreload in time
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