Update std.js

This commit is contained in:
Namhyeon Go 2022-02-08 18:21:15 +09:00 committed by GitHub
parent beedfd6c67
commit 6aa800f692
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -99,7 +99,7 @@ global.sleep = function(ms, callback) {
return { 'ms': end, 'handler': handler };
};
global.repeat = function(ms, callback) {
global.repeat = function(ms, callback, error) {
var handler = null;
var cur = Date.now();
@ -107,7 +107,11 @@ global.repeat = function(ms, callback) {
if (typeof WScript !== "undefined") {
while (cur < end) {
sleep(callback());
try {
sleep(callback());
} catch (e) {
error(e);
}
cur = Date.now();
}
end = Date.now();