timers-ext

WebJar for timers-ext

License

License

ISC
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

timers-ext
Last Version

Last Version

0.1.7
Release Date

Release Date

Type

Type

jar
Description

Description

timers-ext
WebJar for timers-ext
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/medikoo/timers-ext

Download timers-ext

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/timers-ext/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>timers-ext</artifactId>
    <version>0.1.7</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/timers-ext/
implementation 'org.webjars.npm:timers-ext:0.1.7'
// https://jarcasting.com/artifacts/org.webjars.npm/timers-ext/
implementation ("org.webjars.npm:timers-ext:0.1.7")
'org.webjars.npm:timers-ext:jar:0.1.7'
<dependency org="org.webjars.npm" name="timers-ext" rev="0.1.7">
  <artifact name="timers-ext" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='timers-ext', version='0.1.7')
)
libraryDependencies += "org.webjars.npm" % "timers-ext" % "0.1.7"
[org.webjars.npm/timers-ext "0.1.7"]

Dependencies

compile (2)

Group / Artifact Type Version
org.webjars.npm : es5-ext jar [0.10.46,0.11)
org.webjars.npm : next-tick jar [1,2)

Project Modules

There are no modules declared in this project.

Build status Windows status Transpilation status npm version

timers-ext

Timers extensions

Installation

$ npm install timers-ext

To port it to Browser or any other (non CJS) environment, use your favorite CJS bundler. No favorite yet? Try: Browserify, Webmake or Webpack

API

MAX*TIMEOUT *(timers-ext/max-timeout)_

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

delay(fn[, timeout]) (timers-ext/delay)

Returns function which when invoked will call fn function after specified timeout. If timeout is not provided nextTick propagation is used.

once(fn[, timeout]) (timers-ext/once)

Makes sure to execute fn function only once after a defined interval of time (debounce). If timeout is not provided nextTick propagation is used.

var nextTick = require("next-tick");
var logFoo = function() {
	console.log("foo");
};
var logFooOnce = require("timers-ext/once")(logFoo);

logFooOnce();
logFooOnce(); // ignored, logFoo will be logged only once
logFooOnce(); // ignored

nextTick(function() {
	logFooOnce(); // Invokes another log (as tick passed)
	logFooOnce(); // ignored
	logFooOnce(); // ignored
});

validTimeout(timeout) (timers-ext/valid-timeout)

Validates timeout value.
For NaN resolved timeout 0 is returned. If timeout resolves to a number:

  • for timeout < 0 0 is returned
  • for 0 >= timeout <= MAX_TIMEOUT, timeout value is returned
  • for timeout > MAX_TIMEOUT exception is thrown

Tests

$ npm test

Versions

Version
0.1.7
0.1.5
0.1.4
0.1.2
0.1.0