This package has been deprecated

Author message:

this package has been deprecated

xvi-cron

0.0.5 • Public • Published

npm-xvi-cron

Cron

//Add package
const Cron = require('xvi-cron');

//Create instance of the scraper
var instance = new Cron();

//test function
async function test() {
    try {
        console.log('ADD JOB');
        instance.addJob(
            'test', //name anchor
            '*/2 * * * * *', //cron like
            function (args) { //callback
                console.log('DOING JOB');
                console.log(args);
            }, {
                foo: 'bar' //args passed to CB
            }
        );

        //stop and destroy JOB
        setTimeout(function () {
            console.log('STOP AND DESTROY JOB');
            instance.stopJob('test', true);
        }, 5000);
    } catch (err) {
        console.log(err);
    }
}
test();

Will output

170918-210755 |   debug.Cron | canStart = true

ADD JOB
170918-210755 |   debug.Cron | addJob: test, */2 * * * * *
170918-210756 |   debug.Cron | Execute job: test */2 * * * * *

DOING JOB
{ foo: 'bar' }
170918-210758 |   debug.Cron | Execute job: test */2 * * * * *
DOING JOB
{ foo: 'bar' }

STOP AND DESTROY JOB
170918-210800 |   debug.Cron | stopJob: test, detroy = true
170918-210800 |   debug.Cron | destroyJob: test

Readme

Keywords

none

Package Sidebar

Install

npm i xvi-cron

Weekly Downloads

0

Version

0.0.5

License

Apache v2.0

Last publish

Collaborators

  • blavorata