npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mongez/scheduler

v1.0.0

Published

A lightweight scheduler to run tasks in certain times.

Readme

Schedular

A lightweight package for handling tasks/cron-jobs scheduling.

Installation

yarn add @mongez/scheduler

or using npm

npm i @mongez/scheduler

Usage

First you need to create a new instance of the scheduler:

import { Scheduler } from "@mongez/scheduler";

const scheduler = new Scheduler();

scheduler.start();

Job

A job is a task that will be executed at a specific time, so we need to create a new instance of the Job class, it takes the job name, and the callback function that will be executed when the job is triggered.

import { Scheduler, Job } from "@mongez/scheduler";

const scheduler = new Scheduler();

const job = new Job("my-job", () => {
  console.log("Hello world");
});

scheduler.add(job);

scheduler.start();

Scheduling Job

There are multiple ways to schedule a job, you can schedule it to run every minute, every hour, every day, every week, every month, or every year.

Run the job every minute

Run the job every minute:

import { Scheduler, Job } from "@mongez/scheduler";

const scheduler = new Scheduler();

const job = new Job("my-job", () => {
  console.log("Hello world");
});

// Run Every Minute
job.everyMinute();
// OR
job.always();

scheduler.add(job);

scheduler.start();

Run the job every hour

Run the job every hour:

import { Scheduler, Job } from "@mongez/scheduler";

const scheduler = new Scheduler();

const job = new Job("my-job", () => {
  console.log("Hello world");
});

// Run Every Hour
job.everyHour();

Run the job every day

Run the job every day:

import { Scheduler, Job } from "@mongez/scheduler";

const scheduler = new Scheduler();

const job = new Job("my-job", () => {
  console.log("Hello world");
});

// Run Every Day
job.everyDay();

// OR
job.daily();

Run the job twice a day

Run the job twice a day:

import { Scheduler, Job } from "@mongez/scheduler";

const scheduler = new Scheduler();

const job = new Job("my-job", () => {
  console.log("Hello world");
});

// Run Twice a Day
job.twiceDaily();

Run Job every week

Run the job every week:

import { Scheduler, Job } from "@mongez/scheduler";

const scheduler = new Scheduler();

const job = new Job("my-job", () => {
  console.log("Hello world");
});

// Run Every Week
job.everyWeek();

Run Job On Specific Day of the week

Run the Job Every week day:

import { Scheduler, Job } from "@mongez/scheduler";

const scheduler = new Scheduler();

const job = new Job("my-job", () => {
  console.log("Hello world");
});

// Run Every Sunday
job.on("sunday");

// Run Every Monday
job.on("monday");

// Run Every Tuesday
job.on("tuesday");

// Run Every Wednesday
job.on("wednesday");

// Run Every Thursday
job.on("thursday");

// Run Every Friday
job.on("friday");

// Run Every Saturday
job.on("saturday");

Run Job On Specific Time of the day

Run the job every day at a specific time:

import { Scheduler, Job } from "@mongez/scheduler";

const scheduler = new Scheduler();

const job = new Job("my-job", () => {
  console.log("Hello world");
});

job.on("saturday").at("12:00");

The at method accept a string in HH:mm format, defaults to 00:00 if not provided.

Run the job every month

Run the job every month:

import { Scheduler, Job } from "@mongez/scheduler";

const scheduler = new Scheduler();

const job = new Job("my-job", () => {
  console.log("Hello world");
});

job.everyMonth();

Run the job every month on certain month day

Run the job every month on certain month day

import { Scheduler, Job } from "@mongez/scheduler";

const scheduler = new Scheduler();

const job = new Job("my-job", () => {
  console.log("Hello world");
});

job.everyMonth().on(2); // Run the job every month on the second day of the month

Run the job every year

Run the job every year:

import { Scheduler, Job } from "@mongez/scheduler";

const scheduler = new Scheduler();

const job = new Job("my-job", () => {
  console.log("Hello world");
});

job.everyYear();

Run the job at the beginning of time

Run the job at the beginning of time:

import { Scheduler, Job } from "@mongez/scheduler";

const scheduler = new Scheduler();

const job = new Job("my-job", async () => {
  console.log("Hello world");
});

// begin of hour
job.beginOf("hour");

// begin of day
job.beginOf("day");

// begin of week
job.beginOf("week");

// begin of month
job.beginOf("month");

// begin of year
job.beginOf("year");

Run the job at the end of time

Run the job at the end of time:

import { Scheduler, Job } from "@mongez/scheduler";

const scheduler = new Scheduler();

const job = new Job("my-job", async () => {
  console.log("Hello world");
});

// end of hour
job.endOf("hour");

// end of day
job.endOf("day");

// end of week
job.endOf("week");

// end of month
job.endOf("month");

// end of year
job.endOf("year");

Tests

To run tests run npm run test or yarn test

Change Log

  • 1.0.18 (18 Oct 2023)
    • Initial release

TODO

  • Create tests.