Skip to content Skip to sidebar Skip to footer

Later.js Execute Function On Schedule?

I am going through the Later.js docs and it documents how to set the schedule very well - but doesn't show how to execute the function once you've done so. So if I have function lo

Solution 1:

Their documentation does not make this very clear, but later.setInterval takes a schedule as it's second argument.

The examples for this usage are available at http://bunkat.github.io/later/execute.html

so to complete your example,

functionlogit(){
   console.log('it is done');
}

var cron = '15 10 * * ? *';
var s = later.parse.cron(cron);
later.setInterval(logit, s);

hope this helps.

Solution 2:

You need to use the setInterval and setTimeout functions to execute code with schedule:

later.setInterval(logit, s);

Post a Comment for "Later.js Execute Function On Schedule?"