0.0.13 • Published 10 months ago

@harrydehix/everyjs v0.0.13

Weekly downloads
-
License
ISC
Repository
-
Last release
10 months ago

everyjs

A small library that allows you to schedule your tasks in a cron job like way.

Example

import { every } from "everyjs";

const task = every(5, "second").do((time) => {
    console.log(`Hello world! It is: ${time}`);
});

task.start();

Alignment

By default a task is always aligned. E.g. if you schedule a task to be executed every n

  • seconds, it is executed always at the beginning of a second
  • minutes, it is always executed at the beginning of a minute
  • hours, it is always executed at the beginning of an hour
  • weeks, it is always executed at the beginning of a week
  • months, it is always executed at the beginning of a month
  • years, it is always executed at the beginning of a year

You can change the alignment by using the .align(alignment) method.

// This task gets executed every day at 5:30
const task = every(1, "day")
    .do((time) => {
        console.log(`Hello world! It is: ${time}`);
    })
    .align({ hour: 5, minute: 30 });

task.start();
0.0.13

10 months ago

0.0.12

10 months ago

0.0.11

10 months ago

0.0.10

10 months ago

0.0.9

10 months ago

0.0.8

10 months ago

0.0.7

10 months ago

0.0.6

10 months ago

0.0.5

10 months ago

0.0.4

10 months ago

0.0.3

10 months ago

0.0.2

10 months ago

0.0.1

10 months ago

0.0.0

10 months ago