mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-12 04:31:04 +00:00
Update std.js
This commit is contained in:
parent
3090623121
commit
0ed6697c03
13
lib/std.js
13
lib/std.js
|
@ -109,7 +109,7 @@ function sleep(ms, callback) {
|
|||
return { 'ms': end, 'handler': handler };
|
||||
};
|
||||
|
||||
function repeat(target, callback, onError, onNextInterval) {
|
||||
function repeat(target, callback, onError, onNextInterval, onNext) {
|
||||
switch (typeof target) {
|
||||
case "number":
|
||||
case "boolean":
|
||||
|
@ -142,7 +142,7 @@ function repeat(target, callback, onError, onNextInterval) {
|
|||
}
|
||||
}
|
||||
|
||||
// if use the next interval function
|
||||
// if use onNextInterval method
|
||||
if (typeof onNextInterval === "function") {
|
||||
var nextInterval = onNextInterval();
|
||||
if (typeof nextInterval === "number") {
|
||||
|
@ -153,6 +153,15 @@ function repeat(target, callback, onError, onNextInterval) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if use onNext method
|
||||
if (typeof onNext === "function") {
|
||||
try {
|
||||
onNext();
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
// set the last time
|
||||
cur = Date.now();
|
||||
}
|
||||
end = Date.now();
|
||||
|
|
Loading…
Reference in New Issue
Block a user