Socket
Book a DemoInstallSign in
Socket

@harrydehix/everyjs

Package Overview
Dependencies
Maintainers
0
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@harrydehix/everyjs

simple library to repeatedly execute code (every week, day, hour, minute, ...)

0.0.13
latest
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
0
Weekly downloads
 
Created
Source

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();

Keywords

scheduler

FAQs

Package last updated on 28 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.