Update fakeworker.js

This commit is contained in:
Namhyeon Go 2022-11-14 17:06:25 +09:00 committed by GitHub
parent e91d9bd859
commit 8f09b72712
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -72,7 +72,7 @@ function FakeWorker() {
this.__intervals__.push({ this.__intervals__.push({
'id': this.__lastIntervalID__, 'id': this.__lastIntervalID__,
'code': code, 'code': code,
'delay': delay, 'delay': 0, // replace to the callback
'arguments': [], 'arguments': [],
'timestamp': Date.now(), 'timestamp': Date.now(),
'cleared': false, 'cleared': false,
@ -93,6 +93,7 @@ function FakeWorker() {
this.__intervals__[i].delay = this.__intervals__[i].callback(); this.__intervals__[i].delay = this.__intervals__[i].callback();
} }
} }
cur = Date.now();
} }
return intervals; return intervals;
@ -107,6 +108,7 @@ function FakeWorker() {
timeouts.push(this.__timeouts__[i]); timeouts.push(this.__timeouts__[i]);
this.__timeouts__[i].cleared = true; this.__timeouts__[i].cleared = true;
} }
cur = Date.now();
} }
return timeouts; return timeouts;
@ -133,17 +135,17 @@ exports.repeat = function(target, worker, onError) {
} catch (e) { } catch (e) {
if (typeof onError === "function") onError(e, i); if (typeof onError === "function") onError(e, i);
} }
cur = Date.now();
}; };
cur = Date.now();
} }
end = Date.now(); end = cur;
} }
return end; 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.AUTHOR = "catswords@protonmail.com";
exports.global = global; exports.global = global;
exports.require = global.require; exports.require = global.require;