Update std.js

This commit is contained in:
Namhyeon Go 2023-03-14 13:41:49 +09:00 committed by GitHub
parent 6ab0343834
commit 17bbdadbb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,7 +10,6 @@
/////////////////////////////////////////////////////////////////////////////////
// Polyfills
/////////////////////////////////////////////////////////////////////////////////
if (!Function.prototype.GetResource) {
Function.prototype.GetResource = function(ResourceName) {
if (!this.Resources) {
@ -56,7 +55,8 @@ if (!Enumerator.prototype.toArray2) {
x[c.name] = c.value;
}
} else {
var i = 0, d = [];
var i = 0,
d = [];
while (true) {
try {
d.push(c.value(i));
@ -98,15 +98,16 @@ function sleep(ms, callback) {
//WScript.Sleep(ms);
if (typeof callback === "function")
callback()
;
callback();
} else if (typeof window !== "undefined") {
if (typeof callback === "function")
handler = setTimeout(callback, ms);
;
handler = setTimeout(callback, ms);;
}
return { 'ms': end, 'handler': handler };
return {
'ms': end,
'handler': handler
};
};
function repeat(target, callback, onError, onNextInterval, onNext) {
@ -171,7 +172,9 @@ function repeat(target, callback, onError, onNextInterval, onNext) {
}
}
return { 'ms': end, 'handler': handler };
return {
'ms': end, 'handler': handler
};
case "object":
var arr = target;
@ -180,15 +183,11 @@ function repeat(target, callback, onError, onNextInterval, onNext) {
try {
if (typeof callback === "function")
if (callback(i, arr[i]) === false)
break
;
;
break;;
} catch (e) {
if (typeof onError === "function")
if (onError(e, i, arr[i]) === false)
break
;
;
break;;
}
}
}
@ -210,8 +209,7 @@ function rotate(target, callback, onError) {
}
} catch (e) {
if (typeof onError === "function")
stop = onError(e, i, arr[i]);
;
stop = onError(e, i, arr[i]);;
}
i++;
@ -221,7 +219,8 @@ function rotate(target, callback, onError) {
function range() {
var args = arguments;
var N = [], start, end, step;
var N = [],
start, end, step;
switch (args.length) {
case 3:
@ -244,8 +243,7 @@ function range() {
}
for (var i = start; i < end; i = i + step)
N.push(i)
;
N.push(i);
return N;
};
@ -266,8 +264,7 @@ function addslashes(s) {
replace(/\f/g, '\\f').
replace(/\r/g, '\\r').
replace(/'/g, '\\\'').
replace(/"/g, '\\"')
;
replace(/"/g, '\\"');
};
/////////////////////////////////////////////////////////////////////////////////