diff --git a/lib/fakeworker.js b/lib/fakeworker.js index c105111..38dc5b5 100644 --- a/lib/fakeworker.js +++ b/lib/fakeworker.js @@ -72,7 +72,7 @@ function FakeWorker() { this.__intervals__.push({ 'id': this.__lastIntervalID__, 'code': code, - 'delay': delay, + 'delay': 0, // replace to the callback 'arguments': [], 'timestamp': Date.now(), 'cleared': false, @@ -93,6 +93,7 @@ function FakeWorker() { this.__intervals__[i].delay = this.__intervals__[i].callback(); } } + cur = Date.now(); } return intervals; @@ -107,6 +108,7 @@ function FakeWorker() { timeouts.push(this.__timeouts__[i]); this.__timeouts__[i].cleared = true; } + cur = Date.now(); } return timeouts; @@ -133,17 +135,17 @@ exports.repeat = function(target, worker, onError) { } catch (e) { if (typeof onError === "function") onError(e, i); } + cur = Date.now(); }; - cur = Date.now(); } - end = Date.now(); + end = cur; } return end; }; -exports.VERSIONINFO = "FakeWorker module (fakeworker.js) version 0.0.3"; +exports.VERSIONINFO = "FakeWorker module (fakeworker.js) version 0.0.4"; exports.AUTHOR = "catswords@protonmail.com"; exports.global = global; exports.require = global.require;