Chall
Chall is a lightweight cronjob library in JavaScript.
Installing Chall
To install Chall, run the following command:
npm install chall
Using Chall
const chall = require('chall');
// To schedule a job:
const func = country => {
console.log(`Hello world from ${country}!`);
};
const arg = 'Vietnam';
const time = '14:45'; // format HH:MM
const interval = 12 * 60 * 60 * 1000; // milliseconds between execution after first trigger
const jobId = chall.schedule(func, time, interval, arg);
// To manually trigger a job:
chall.trigger(jobId);
// To stop a job:
chall.stop(jobId);
// To use Chall's constructor:
const { Chall } = require('chall');
const newChall = new Chall();
Contributing to Chall
To contribute to Chall, follow these steps:
- Fork this repository.
- Create a branch:
git checkout -b <branch_name>
. - Make your changes and commit them:
git commit -m '<commit_message>'
- Push to the original branch:
git push origin chall/<location>
- Create the pull request.
Alternatively see the GitHub documentation on creating a pull request.
Contributors
Thanks for the idea from Hao Walker.
License
This project uses the following license: MIT.