Last active
May 2, 2017 14:20
-
-
Save amuntasim/d8ec7bcc1ac7447c9026c466cad7dc37 to your computer and use it in GitHub Desktop.
call a javascript method at specific 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
var triggered = false; | |
(function loop() { | |
var now = new Date(); | |
// here the method will be triggered at 20:28, you can change them as per your need | |
if (!triggered && now.getHours() === 20 && now.getMinutes() === 28) { | |
method(); | |
triggered = true; | |
} | |
console.log('Now: ' + now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds()); | |
setTimeout(loop, 200); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment