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

pause-me

v2.1.3

Published

A small dependency free setTimeout utilitnpmy that allows pausing, resuming, stopping and starting a timeout or interval.

Readme

Dynamic JSON Badge Static Badge install size Dynamic JSON Badge Node.js CI

pause-me, A Dependency Free setTimeout Utility

[ pause-me on npm ]

The "pause-me" utility allows pausing, resuming, stopping and starting a setTimeout.

Install

$ npm install pause-me --save  
$ yarn add pause-me

Usage

ESM Import (Recommended)

import pauseMe from "pause-me";

CommonJS Require

const pauseMe = require("pause-me");

Basic Usage

Use it like you would a setTimeout

const myTimeout = pauseMe(() => {  
  console.log("timed out!");
}, 5000);

or

const myTimeoutFunc = () => {
  console.log("timed out!");
};

const myTimeout = pauseMe(myTimeoutFunc, 5000);  

TypeScript Support

As of version 2.0.0, pause-me is written in TypeScript and includes type definitions out of the box:

import pauseMe from "pause-me";

// The returned object is fully typed
const myTimeout = pauseMe(() => {
  console.log("timed out!");
}, 5000);

// TypeScript will provide autocomplete and type checking
myTimeout.pause();

New in v2.1.0: Direct Timer and Interval Creation

Version 2.1.0 introduces two new functions for creating timers and intervals directly:

import { getTimeout, getInterval } from "pause-me";

// Create a timeout directly
const myTimeout = getTimeout(() => {
  console.log("Timeout executed!");
}, 5000);

// Create an interval directly
const myInterval = getInterval(() => {
  console.log("Interval executed!");
}, 1000);

These functions provide the same interface as the original pauseMe function but make the intent clearer when you specifically need a timeout or interval.

Interval Mode

You can also use it as a setInterval by setting the repeating parameter to true.

let counter = 0;
const myInterval = pauseMe(() => {  
  counter++;
  console.log("Interval " + counter);
}, 5000, true);

API

pause

Pause the timeout anywhere myTimeout is in scope.

myTimeout.pause();  

resume

Resume the timeout anywhere myTimeout is in scope.

myTimeout.resume();  

stop

Clear the timeout.

myTimeout.stop();  

This does not remove myTimeout from the scope.

start

Start the timeout from the beginning again.

myTimeout.start();  

restart

Restart the timeout at any point.

myTimeout.restart();

timer

Test the setTimeout instance to see whether or not it is still running.

if (myTimeout.timer() === null) {  
  // myTimeout is not running
} else {
  // myTimeout is running
}

Breaking Changes

Version 2.1.0

  • Added new functions getTimeout and getInterval for direct timer/interval creation
  • Improved internal architecture with abstract class implementation
  • Enhanced type safety and error handling
  • More accurate remaining time calculation
  • Better handling of edge cases

Version 2.0.0

  • Converted to TypeScript with full type definitions
  • Changed to ESM format by default (CommonJS still supported)
  • Updated module exports to support both ESM and CommonJS
  • Improved error handling and type checking
  • Arrow functions used for better this binding
  • Stricter type checking for parameters

Version 1.3.0

Previously, stop would not do anything if the timeout was paused. This behavior is not intuitive, so now stop will clear the timeout and reset the timer even if the timeout is paused.

License

Published under the MIT license.