Last active
July 4, 2021 15:01
-
-
Save rayhanadev/df014dbb5d872d89f27f36325dcaaf40 to your computer and use it in GitHub Desktop.
Interval Based Function Caller
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 startInterval() { | |
(function loop() { | |
var now = new Date(); | |
// Set the time here | |
if (now.getDay() === 0 && now.getHours() === 0 && now.getMinutes() === 59) { | |
/* Place function to execute here */ | |
} | |
now = new Date(); | |
var delay = 60000 - (now % 60000); | |
setTimeout(loop, delay); | |
})(); | |
} | |
if (_startInterval) startInterval(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment