🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

timeunit

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

timeunit - npm Package Compare versions

Comparing version

to
1.1.0

2

bower.json
{
"name": "timeunit",
"version": "1.0.1",
"version": "1.1.0",
"description": "Port of Doug Lea's TimeUnit Java class to JavaScript.",

@@ -5,0 +5,0 @@ "main": "lib/timeunit.js",

@@ -1,2 +0,9 @@

* 1.0.1 - Make `sleep()` always go through `setTimeout()`, even if the interval is 0.
* 1.0.0 - Initial release.
## 1.1.0
* Add support for canceling timeouts.
* Add support for intervals.
## 1.0.1
* Make `sleep()` always go through `setTimeout()`, even if the interval is 0.
## 1.0.0 - Initial release.
* Initial release.

@@ -66,3 +66,3 @@ // Generated by CoffeeScript 1.6.3

},
sleep: function(timeout, done) {
sleep: function(timeout, fn) {
var ms;

@@ -73,4 +73,11 @@ if (timeout < 0) {

ms = this.toMillis(timeout);
setTimeout(done, ms);
return null;
return setTimeout(fn, ms);
},
interval: function(interval, fn) {
var ms;
if (interval < 0) {
throw new Error("Invalid interval: " + interval + " " + this.name);
}
ms = this.toMillis(interval);
return setInterval(fn, ms);
}

@@ -106,2 +113,4 @@ };

});
exports.clearTimeout = clearTimeout;
exports.clearInterval = clearInterval;
return exports;

@@ -108,0 +117,0 @@ });

@@ -5,3 +5,3 @@ {

"keywords": ["TimeUnit", "time conversion", "Doug Lea"],
"version": "1.0.1",
"version": "1.1.0",
"author": "Jason Walton (https://github.com/jwalton)",

@@ -8,0 +8,0 @@ "contributors": [

@@ -40,3 +40,4 @@ TimeUnit js

Perhaps even more useful in CoffeeScript, where it is a little easier to use that setTimeout:
Perhaps even more useful in CoffeeScript, where it is a little easier to use that setTimeout, since
it follows the "callback at the end" idiom used by most node.js code:

@@ -43,0 +44,0 @@ timeunit.seconds.sleep 5, () ->

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet