Comparing version 0.0.6 to 0.0.7
17
index.js
'use strict' | ||
var slice = Array.prototype.slice | ||
var dateNow = require('date-now') | ||
@@ -9,12 +10,12 @@ | ||
function clocktick (callback, timeout, offset) { | ||
var self, args, now, nowRounded, nextTick | ||
var timeout = (timeout * 1000) || 1000 | ||
var offset = (offset * 1000) || 0 | ||
var self = this | ||
var args = slice.call(arguments, 2) | ||
self = this | ||
args = Array.prototype.slice.call(arguments, 2) | ||
now = dateNow() | ||
nowRounded = (now / timeout | 0) * timeout | ||
nextTick = timeout - (now - nowRounded) + offset | ||
timeout = (timeout * 1000) || 1000 | ||
offset = (offset * 1000) || 0 | ||
var now = dateNow() | ||
var nowRounded = (now / timeout | 0) * timeout | ||
var nextTick = timeout - (now - nowRounded) + offset | ||
return setTimeout(function () { | ||
@@ -21,0 +22,0 @@ callback && callback.apply(self, args) |
{ | ||
"name": "clocktick", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Clock-accurate timeout for Node.js and browser", | ||
@@ -24,6 +24,6 @@ "main": "index.js", | ||
"devDependencies": { | ||
"browserify": "^5.10.1", | ||
"tap-spec": "^0.2.1", | ||
"tape": "^2.14.0" | ||
"browserify": "^10.2.4", | ||
"tap-spec": "^4.0.2", | ||
"tape": "^4.0.0" | ||
} | ||
} |
5233