Skip to content

Commit

Permalink
Fix to add constructors' static methods to proxy functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulcuth committed Jun 16, 2014
1 parent fe80d46 commit 1ee194a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion extensions/DOMAPI/DOMAPI.moonshine.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
mt = new shine.Table({

__index: function (t, key) {
var property = obj[key];
var property = obj[key],
i, children, child;

// Bind methods to object and convert args and return values
if (typeof property == 'function' || (property && property.prototype && typeof property.prototype.constructor == 'function')) { // KLUDGE: Safari reports native constructors as objects, not functions :-s
Expand All @@ -40,6 +41,15 @@
return [retval];
};

// Add static methods, etc
if (Object.getOwnPropertyNames) {
children = Object.getOwnPropertyNames(property);

for (i = 0; child = children[i]; i++) {
f[child] = property[child];
}
}

// Add a new method for instantiating classes
f.new = function () {
var args = convertArguments(arguments, luaToJS),
Expand Down

0 comments on commit 1ee194a

Please sign in to comment.