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

skedr

v1.1.0

Published

A simple scheduler library

Downloads

1

Readme

Skedr

====

Installation

npm install skedr

Usage

Skedr offers a lot of possibilities. First of all, let's review the types of schedulers:

  • Repeaters
  • Schedulers
  • One-time (same as setTimeout);

All of these return an object of type Scheduler, which has 3 main methods:

  • launch(): Launches the scheduler object, whether to repeat, to schedule or to launch once.

  • stop() and clear(): Stops the scheduler from whatever it's doing

  • stopAfter(params): params is a dictionary of one key, that can be whether time (in ms) or clicks.

Repeaters

Repeaters are functions that repeat programatically, like you would with setInterval. However, as they are stored in a Scheduler object you can stop and launch them any time.

You instanciate a repeater like so:

var repeater = Skedr.repeat.every(<time>).for(<function>);

One-time scheduler

One time schedulers behave just like setTimeout, however, as they are stored inside a Scheduler object, you are free to .stop() or .launch() it whenever you wish, and it's function will always be stored in it.

var once = Skedr.once(<time>, <function>);

Schedulers

Schedulers are the real reason this library exists. With them you can schedule functions to execute in X time, at X time and repeat every Y time.

The library provides a lot of options to instanciate schedulers, but let's start with the most important one:

Starting in X minutes

var scheduler = Skedr.schedule.every(time_in_ms).for(nice_function).starting.in(in_x_minutes);

Starting at 3 PM

var scheduler = Skedr.schedule.every(time_in_ms).for(nice_function).starting.at(three_pm);

Both schedulers will have to be launched using .launch().

There are some utility functions to simplify scheduling:

Skedr.schedule.every.{hour|day|week}(time, function);

Dates

Of course, '3:45PM' won't work. So we provide a simple SchedulerDate class which allows simple date writing.

var date = new Skedr.Date() will instanciate a normal date, holding now as the time.

var date = new Skedr.Date(true) will instanciate a void date, at time 0;

To write 3:45 PM you just instanciate a date and use the utility functions (ms, s, m, h, D, M, Y):

var PM_3_45 = (new Skedr.Date(true)).h(15).m(45);

Which allows you to call: var scheduler = Skedr.schedule.every(<time_in_ms>).for(<nice_function>).starting.at(PM_3);