mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-10 05:36:04 +00:00
Update fakeworker.js
This commit is contained in:
parent
e91d9bd859
commit
8f09b72712
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user