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 🙏

© 2024 – Pkg Stats / Ryan Hefner

gcron

v0.1.0

Published

Cron like scheduler for Node

Downloads

2

Readme

gcron

Cron like scheduler for Node, with one (minor?) difference. When used with steps that do not properly divide 60 (or 12 for months), Cron rounds off the values to 0 when it exceeds that current limit. This library, on the other hand, will continue stepping through original values. For example, */7 * * * * will start from current minute and keep adding 7, wrapping around to next minute, continuing with what is left from previous minute. This is useful when repeated alarms are set.

One exception to the above is when you use multiple repeats or list/ranges for higher units (in that case lower units are reset to their start values).

Repeat steps are supported, as long as they are within the unit's boundaries Ex: */7 * * * * Callback is called at 7,14,21 etc minutes of every hour

Lists are supported where a comma separated ordered numbers can be provided as possible values for any units Ex: 1,7,9 * * * * Callback is called at 1,7 and 9th minute of every hour

Ranges are supported where initial number (positive integer) and final number are provided, separated by '-' Ex: 4-10 * * * * Callback is called for 4,5,6,7,8,9 and 10th minutes of every hour

Lists and rages can be mixed Ex: 2,5,9-12 * * * *

Ranges and repeats can be mixed together Ex: 2,5,9-24/3 * * * * => 2,5,9,12,15,18,21,24 * * * *

Installation

npm install gcron --save

Usage

//called every minute
var j1 = new cron.cron('* * * * *', function(){
    console.log('tick @'+moment().format());
});

//called every 2nd minute
var j1 = new cron.cron('*/2 * * * *', function(){
    console.log('tick @'+moment().format());
});

//called every 11th minute and does not break at the turn of hour boundary
// ex: 10:11:00 10:22:00 10:33:00 10:44:00 10:55:00 11:06:00 11:17:00 ...
var j3 = new cron.cron('*/7 * * * *', function(){
    console.log('tick @'+moment().format());
});

setTimeout(function(){
	j1.stop();
	j2.stop();
}, 10*60*1000);

Limitations

Seconds and weeks are not supported