chfritz:easycron

v0.0.4Published 10 years ago

This package has not had recent updates. Please investigate it's current state before committing to using it in your project.

meteor-easycron

Meteor package for specifing cron like recurring jobs easily.

The usage is very simple

1var recurrence = new Cron(function, schedule);

where schedule is an object that for each of minute, hour, and day either specifies a specific value, or none at all which implies "every". So for instance, the empty object {} means every minute of every hour of every day. On the other hand {day: 12} means every minute of every hour of every 12th of the month.

Examples

1var everyMinute = new Cron(function() {
2    console.log("another minute has passed!");
3}, {});
4
5var everyHour = new Cron(function() {
6    console.log("it is 24 minutes past the hour");
7}, {
8    minute: 24
9});
10
11var everyMinuteBetween8and9 = new Cron(function() {
12    console.log("a minute has passed and it is between 8am and 9am");
13}, {
14    hour: 8
15});
16
17var onceEveryMonth = new Cron(function() {
18    console.log("it is high-noon on the 13th of the month, see you next month");
19}, {
20    minute: 0,
21    hour: 12,
22    day: 13
23});