Update fakeworker.js

This commit is contained in:
Namhyeon Go 2022-10-28 02:44:57 +09:00 committed by GitHub
parent 2ce0c4b637
commit f29556ed14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;