mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-03-12 08:55:14 +00:00
Update std.js
This commit is contained in:
parent
3b157000f1
commit
0f5b25c5aa
34
lib/std.js
34
lib/std.js
|
@ -10,6 +10,7 @@
|
|||
/////////////////////////////////////////////////////////////////////////////////
|
||||
// Polyfills
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
if (!Function.prototype.GetResource) {
|
||||
Function.prototype.GetResource = function(ResourceName) {
|
||||
if (!this.Resources) {
|
||||
|
@ -27,16 +28,37 @@ if (!Function.prototype.GetResource) {
|
|||
}
|
||||
}
|
||||
|
||||
// MS JScript Enumerator to Array
|
||||
if (!Enumerator.prototype.toArray) {
|
||||
Enumerator.prototype.toArray = function() {
|
||||
var items = [];
|
||||
var a = [];
|
||||
for (; !this.atEnd(); this.moveNext()) {
|
||||
var item = this.item();
|
||||
var x = {};
|
||||
var b = new Enumerator(this.item().Properties_);
|
||||
for (; !b.atEnd(); b.moveNext()) {
|
||||
var c = b.item();
|
||||
if (typeof c.value !== "unknown") {
|
||||
try {
|
||||
items.push(item);
|
||||
} catch (e) {}
|
||||
x[c.name] = c.value.toString();
|
||||
} catch (e) {
|
||||
x[c.name] = c.value;
|
||||
}
|
||||
return items;
|
||||
} else {
|
||||
var i = 0, d = [];
|
||||
while (true) {
|
||||
try {
|
||||
d.push(c.value(i));
|
||||
i++;
|
||||
} catch (e) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
x[c.name] = d;
|
||||
}
|
||||
}
|
||||
a.push(x);
|
||||
}
|
||||
return a;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -189,7 +211,7 @@ var StdEventableObject = function() {
|
|||
};
|
||||
};
|
||||
|
||||
exports.VERSIONINFO = "Standard Lib (std.js) version 0.3";
|
||||
exports.VERSIONINFO = "Standard Lib (std.js) version 0.4";
|
||||
exports.global = global;
|
||||
exports.require = global.require;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user