mirror of
https://github.com/gnh1201/welsonjs.git
synced 2024-11-26 23:41:42 +00:00
Update std.js
This commit is contained in:
parent
beedfd6c67
commit
6aa800f692
|
@ -99,7 +99,7 @@ global.sleep = function(ms, callback) {
|
||||||
return { 'ms': end, 'handler': handler };
|
return { 'ms': end, 'handler': handler };
|
||||||
};
|
};
|
||||||
|
|
||||||
global.repeat = function(ms, callback) {
|
global.repeat = function(ms, callback, error) {
|
||||||
var handler = null;
|
var handler = null;
|
||||||
|
|
||||||
var cur = Date.now();
|
var cur = Date.now();
|
||||||
|
@ -107,7 +107,11 @@ global.repeat = function(ms, callback) {
|
||||||
|
|
||||||
if (typeof WScript !== "undefined") {
|
if (typeof WScript !== "undefined") {
|
||||||
while (cur < end) {
|
while (cur < end) {
|
||||||
|
try {
|
||||||
sleep(callback());
|
sleep(callback());
|
||||||
|
} catch (e) {
|
||||||
|
error(e);
|
||||||
|
}
|
||||||
cur = Date.now();
|
cur = Date.now();
|
||||||
}
|
}
|
||||||
end = Date.now();
|
end = Date.now();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user