$ npm install timers-ext
Maximum possible timeout value in milliseconds. It equals to maximum positive value for 32bit signed integer, so 2³¹ (2147483647), which makes it around 24.9 days
Returns function which when invoked will call fn function after specified timeout. If timeout is not provided nextTick propagation is used.
Makes sure fn function is invoked only once in given timeout span. If timeout is not provided nextTick propagation is used.
var nextTick = require'next-tick';var console.log'foo'; ;var logFooOnce = require'timers-ext/once'logFoo;logFooOnce;logFooOnce; // ignored, logFoo will be logged only oncelogFooOnce; // ignorednextTicklogFooOnce; // Invokes another log (as tick passed)logFooOnce; // ignoredlogFooOnce; // ignored;
Validates timeout value.
NaN resolved timeout
0 is returned.
If timeout resolves to a number:
- for timeout < 0
- for 0 >= timeout <= MAX_TIMEOUT,
timeoutvalue is returned
- for timeout > MAX_TIMEOUT exception is thrown
$ npm test