Socket
Socket
Sign inDemoInstall

@types/node-schedule

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/node-schedule

TypeScript definitions for node-schedule


Version published
Weekly downloads
120K
decreased by-18.23%
Maintainers
1
Weekly downloads
 
Created

What is @types/node-schedule?

@types/node-schedule provides TypeScript definitions for the node-schedule package, which is a flexible cron-like and not-cron-like job scheduler for Node.js.

What are @types/node-schedule's main functionalities?

Scheduling a Job

This feature allows you to schedule a job using a cron-like syntax. In this example, the job is scheduled to run at the 42nd minute of every hour.

const schedule = require('node-schedule');

const job = schedule.scheduleJob('42 * * * *', function(){
  console.log('The answer to life, the universe, and everything!');
});

Canceling a Job

This feature allows you to cancel a scheduled job. In this example, the job is canceled before it has a chance to run.

const schedule = require('node-schedule');

const job = schedule.scheduleJob('42 * * * *', function(){
  console.log('The answer to life, the universe, and everything!');
});

job.cancel();

Rescheduling a Job

This feature allows you to reschedule an existing job. In this example, the job is rescheduled to run at the 10th minute of every hour.

const schedule = require('node-schedule');

const job = schedule.scheduleJob('42 * * * *', function(){
  console.log('The answer to life, the universe, and everything!');
});

job.reschedule('10 * * * *');

Scheduling a Job with Recurrence Rule

This feature allows you to schedule a job using a recurrence rule. In this example, the job is scheduled to run at 5:42 PM on weekdays and Sundays.

const schedule = require('node-schedule');

const rule = new schedule.RecurrenceRule();
rule.dayOfWeek = [0, new schedule.Range(1, 5)];
rule.hour = 17;
rule.minute = 42;

const job = schedule.scheduleJob(rule, function(){
  console.log('The answer to life, the universe, and everything!');
});

Other packages similar to @types/node-schedule

FAQs

Package last updated on 03 May 2022

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