Tasks Manager
Simple and useful tasks manager for nodejs.
const {loader} = require('task-manager');
loader();
Instalation
This is a Node.js module available through the npm registry.
Before installing, download and install Node.js. Node.js 0.10 or higher is required.
If this is a brand new project, make sure to create a package.json
first with
the npm init
command.
Installation is done using the
npm install
command:
$ npm install tasks-manager
Features
- Autoloader of tasks
- Async/Sync Tasks
- Interval Time assignation
- Execution after finish the previous execution
- Balancers Logic
- Dynamic Balancer
- Process per task and balancer
Usage
Create a new file with name task.js
in the root folder or subfolder with the follow structure:
const {Task} = require('tasks-manager');
module.exports = new Task({
name: 'Greater',
task: async function task(balancer) {
console.log(`Hi, I'm a task with name ${this.name} and my name is ${balancer}`);
},
interval: 2000,
balancers: ['John', 'Jane'],
});
In the index.js
just add the loader
const {loader} = require('task-manager');
loader();
Now execute the code npm start
or node index.js