1.1.4 • Published 8 months ago

@headwall/easy-cronjs v1.1.4

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

easy-cronjs

A simple tool for running multiple periodic tasks at regular intervals.

There's a global start/stop and jobs can be started/stopped individually too.

Installation

npm install @headwall/easy-cronjs

Usage

const cron = require('@headwall/easy-cronjs');

// Enable diagnostics (optional).
// cron.enableDiagnostics = true;
// Do something every 1000ms (one second interval)

cron.addJob('My Cron Job', 1000, () => {
	console.log('tick');
});

// Start easy-cronjs
cron.start();

//
// Your application logic...
//

// Stop easy-cronjs
cron.stop();

// All done
console.log('end');

Other useful bits

// Disable an individual job by name.
cron.disableJob('My Cron Job');


// Enable an individual job by name.
cron.enableJob('My Cron Job');


// How many jobs are currently managed?
console.log(cron.getJobCount());

Scripts

# Run tests
npm run test

# Build a distribution zip
npm run build

# Clean all builds
npm run clean
1.1.4

8 months ago

1.1.3

8 months ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.1.0

2 years ago