bus.js

0.9.3 • Public • Published

bus.js

A library to run jobs in repeated or scheduled manner

This is a basic library which runs the jobs repeatedly. You can use the options available to make use of all available features.

Install the library

npm install bus.js

Initiate the Scheduler as shown below

var Bus = require("./new-bus.js/index");
var Scheduler = new Bus({delay: 1000});

delay is the step wait for the scheduler in milli seconds.

Add your jobs to the scheduler with add member

Scheduler.add({every: 3, payload: ["This is my data"]}, function(data){
    console.log("Hello!", data.payload);
});
Scheduler.start();

Available options for add call

  • from - a date object
  • to - a date object
  • every - integer; the step gap
  • payload - payload which needs to be passed to the job

Package Sidebar

Install

npm i bus.js

Weekly Downloads

10

Version

0.9.3

License

MIT

Last publish

Collaborators

  • codeorroad