Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Manage timeouts that are not limited to 24.8 days in JavaScript
JavaScript
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
CHANGELOG.md
LICENSE
Makefile
README.md
index.js
package.json

README.md

Infinite timeout library for JavaScript and Node.js

Native setTimeout functions are limited to INT32 (2147483647 milliseconds or roughly 24.8 days). This library makes it possible to set timeouts with a nearly unlimited delay.

Usage in Node.js

Set timeout

var timeout = require('infinite-timeout');
timeout.set(function(){
    console.log('This took 30 days');
}, 2592000000);

Clear timeout

var timeout = require('infinite-timeout');
var id = timeout.set(callback, delay);
timeout.clear(id);

Usage in browsers

Load script

<script src="lib/timeout.js"></script> 

Set timeout

timeout.set(function(){
    console.log('This took 30 days');
}, 2592000000);

Clear timeout

var id = timeout.set(callback, delay);
timeout.clear(id);

Developing

The library is published to NPM and can be installed with the following command:

$ npm install infinite-timeout

Testing

Navigate to this module's repository and make sure you have the development modules installed:

$ npm install

Run the tests:

$ npm test
Something went wrong with that request. Please try again.