diff --git a/lib/fakeworker.js b/lib/fakeworker.js index 4517072..c105111 100644 --- a/lib/fakeworker.js +++ b/lib/fakeworker.js @@ -117,7 +117,7 @@ exports.create = function() { return new FakeWorker(); }; -exports.repeat = function(target, worker) { +exports.repeat = function(target, worker, onError) { if (!(worker instanceof FakeWorker)) return; if (["number", "boolean"].indexOf(typeof target) > -1) { @@ -129,7 +129,7 @@ exports.repeat = function(target, worker) { var intervals = worker.getIntervals(); for (var i = 0; i < intervals.length; i++) { try { - if (typeof intervals[i].code === "function") x.code(i); + if (typeof intervals[i].code === "function") intervals[i].code(i); } catch (e) { if (typeof onError === "function") onError(e, i); } @@ -143,7 +143,7 @@ exports.repeat = function(target, worker) { return end; }; -exports.VERSIONINFO = "FakeWorker module (fakeworker.js) version 0.0.2"; +exports.VERSIONINFO = "FakeWorker module (fakeworker.js) version 0.0.3"; exports.AUTHOR = "catswords@protonmail.com"; exports.global = global; exports.require = global.require;