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

@eomm/set-huge-timeout

v1.0.0

Published

setTimeout without the 32 bit int boundaries

Readme

@eomm/set-huge-timeout

setTimeout handles delay as a 32-bit signed integer. This causes an integer overflow when using delays larger than 2,147,483,647 ms (about 24.8 days), resulting in the timeout being executed immediately.

This package bypass this limit using a recursive setTimeout call hiding the complexity!

Install

npm install @eomm/set-huge-timeout

Usage

Use it as a normal setTimeout call, but without caring about the limit!

Note that the returned value is an object instead of a Timeout object.

The object has two properties:

  • timeout: This is the reference to the timeout, so you can clear it using clearTimeout
  • emitter: This is an EventEmitter that emits some utility events:
    • reschedule: Emitted when the timeout is rescheduled

Keep in mind that the timeout property is updated at every internal reschedule, so you can clear the timeout at any time only if you read the timeoutReference.timeout property, otherwise you may read an old reference.

const { setHugeTimeout } = require('@eomm/set-huge-timeout')

const oneYear = 31_536_000_000

const timeoutReference = setHugeTimeout((message) => {
  console.log(message)
}, oneYear, 'Hello, world!')

timeoutReference.emitter.on('reschedule', (timeLeft) => {
  console.log(`Rescheduled to ${timeLeft}`)
})

// Clear the timeout
clearTimeout(timeoutReference.timeout)

Test mode

This module has a test mode that allows to ease the testing of huge timeouts.

Here is an example using Sinon Fake Timers:

const FakeTimers = require('@sinonjs/fake-timers')
const HugeTimeout = require('@eomm/set-huge-timeout')

const { setHugeTimeout } = HugeTimeout

const clock = FakeTimers.createClock()

// Overwrite the internal setTimeout with the fake one.
// All the huge timeouts will be handled by the fake clock
// after this call.
hugeTimeout.test.overwriteSetTimeout(clock.setTimeout)

const waitMs = 2_147_483_999

// This timeout will be handled by the fake clock
setHugeTimeout(() => {
  console.log('Timeout!')
}, waitMs)

// Move the clock forward
clock.tick(waitMs) // Output: Timeout!

// Restore the original setTimeout when it's not needed anymore
hugeTimeout.test.restore()

License

Copyright Manuel Spigolon, Licensed under MIT.