Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

simple-job-scheduler

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-job-scheduler

A simple job scheduling system written in TypeScript

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
329
increased by15.44%
Maintainers
1
Weekly downloads
 
Created
Source

Simple Job Scheduler

This is a simple JavaScript scheduling system written in TypeScript. It is a small wrapper around the setInterval JavaScript function.

Usage

// you should keep only one scheduler instance in your project
// (using either a static reference or using a dependency injection system)
const scheduler = new Scheduler();
// the job will be executed every second
const job = scheduler.schedule('job name', () => console.log('Hello World!'), 1000);
// after some time...
job.cancel();

Why create a library instead of using setInterval?

Have you ever inadvertently launched multiple times the same job? Do you ever wonder if your jobs has successfully been cancelled? Simple Job Scheduler tries to address these issues:

  • If the same running job is scheduled twice or more, only the first scheduling time will be taken into account (a job is identified by its name)
  • The method scheduler.runningJobs() returns all the running jobs

Keywords

FAQs

Package last updated on 14 Dec 2020

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc