chall

[![NPM](https://nodei.co/npm/chall.png?compact=true)](https://www.npmjs.com/package/chall)


Keywords
cronjob, javascript
License
MIT
Install
npm install chall@1.0.2

Documentation

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:

  1. Fork this repository.
  2. Create a branch: git checkout -b <branch_name>.
  3. Make your changes and commit them: git commit -m '<commit_message>'
  4. Push to the original branch: git push origin chall/<location>
  5. 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.