@niradler55/schedulerjs

1.0.2 • Public • Published

SchedulerJs

Scheduler for node js to timing time base tasks.

How to use

  • npm i --save @niradler55/schedulerjs
const Scheduler = require('@niradler55/schedulerjs/dist');
const sch = new Scheduler();
const task = {
    title: 'example',
    fn: () => console.log('run every 1 second, success', new Date()),
    onFailed: (e) => console.log(e),
    repeatPeriod: 1000,
    isRepeat: true,
  };

  sch.start();
  sch.addTask(task)

APIs

.start

.start

init the scheduler, and start looking for tasks.

.addTask

.addTask(task, [tasks...])

.addTask take one task or array of tasks.

add task or tasks to tasks list.

.stop

.stop

stop looking for tasks (going idle).

.getLogByProcessId

.getLogByProcessId(processId)

.getLogByProcessId

return log for the current instance or by given id.

.updateTask

.updateTask(locString, task)

.updateTask

update task at location.

.deleteTask

.deleteTask(locString)

.deleteTask

delete task at location.

Properties

.log

.log

get all log event

.tasks

.tasks

get all tasks

Readme

Keywords

Package Sidebar

Install

npm i @niradler55/schedulerjs

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

22.8 kB

Total Files

18

Last publish

Collaborators

  • niradler55