
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
@types/node-schedule
Advanced tools
TypeScript definitions for 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.
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!');
});
node-cron is a lightweight task scheduler in pure JavaScript for Node.js based on the cron syntax. It is similar to node-schedule but focuses solely on cron-like scheduling without additional features like recurrence rules.
agenda is a light-weight job scheduling library for Node.js that uses MongoDB for persistence. It offers more advanced features like job prioritization, job concurrency, and job persistence, making it more suitable for complex scheduling needs compared to node-schedule.
bree is a job scheduler for Node.js with a focus on simplicity and performance. It uses worker threads to run jobs in parallel and supports cron syntax. It is more modern and performant compared to node-schedule.
npm install --save @types/node-schedule
This package contains type definitions for node-schedule (https://github.com/node-schedule/node-schedule).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node-schedule.
These definitions were written by Cyril Schumacher, Florian Plattner, Tieu Philippe Khim, and Seohyun Yoon.
FAQs
TypeScript definitions for node-schedule
The npm package @types/node-schedule receives a total of 153,345 weekly downloads. As such, @types/node-schedule popularity was classified as popular.
We found that @types/node-schedule demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.