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 🙏

© 2025 – Pkg Stats / Ryan Hefner

node-timers

v0.0.2

Published

Timer and stopwatch utility modules

Downloads

341

Readme

node-timers

Quick and simple timer utilities that give you enough control.

Getting started

Get it: npm install node-timers

Use it:

var node-timers = require('node-timers'); //or
var simpleTimer = require('node-timers/simple'); //or
var timer = require('node-timers/timer'); //or
var countdown = require('node-timers/countdown');

var myTimer = node-timers.simple(); // timer or countdown can be created from here too...

// passing an options object with the pollInterval will generate a 'poll' event ever X milliseconds
// passing no such pollInterval value will create a timer that can be controlled (start, stop, reset)
// but will not ping you with updates.
var simple = simpleTimer({pollInterval: 100});

//Starts keeping track of passed time...
simple.start();

//returns the time that has passed in milliseconds
simple.time();

Reasoning

I seemed to be rewriting this stuff on a regular occasion for different projects. Either misplacing the source or using the modules in a slightly different way. This set gives me enough leway to do what I want without controlling the output like other timer modules I have looked at. The output should be up to the app.

API

simple(options)

Creates a new simple timer. Keeps track of time passed. Options are optional. Options can include pollInterval which, while the timer is on an on state, will emit a poll event with the current passed time in milliseconds.

start()

Starts the timer you have created. Emits a start event

stop()

Stops the timer. Emits a stop event

time(newTime)

Getter and setter for the passed time of your timer. If you specifiy a newTime value, then the timer will attempt to set itself to that new value before returning the passed time in milliseconds.

reset()

Resets your timer back to it's initial state. Emits a reset event

state()

Returns the current state of the timer. Either on, stopped, or clean

timer(options)

A limited timer based on simple. Additional options to pollInterval include finishTime. When the timer has reached the finish time stated, it will emit a done event. pollInterval defaults to 250 and finishTime defaults to 0.

countdown(options)

A timer that counts down from a startTime passed though the options object. In this case, time() returns the time remaining instead of the time passed. Once the timer reaches 0, it will emit a done event.

Events

| Event | Description | | ------ | ------ | | start | Event triggered when timer starts. | | stop | Triggered when the timer stops. | | reset | Timer has been reset. | | poll | Update the user with the currently passed time or time that is left. time is passed as argument to the listener | | done | Only timer and countdown emit this. When we have reached the given endtime or 0 |