later
later copied to clipboard
Step 5 setInterval sample misfiring
Just ran a quick test using Step 5 listed on the github.io page: https://bunkat.github.io/later/
I made some small tweaks to the code from the sample when testing setInterval
:
// will fire every 1 minute
var textSched = later.parse.text('every 1 min');
// execute logTime for each successive occurrence of the text schedule
var timer2 = later.setInterval(logTime, textSched);
// function to execute
function logTime() {
console.log(new Date());
}
It fired correctly the first time, but on the second interval it fired logTime()
3 times in a row, right away.