Skip to content

Commit 08d3e94

Browse files
committed
#249 fix for missing inherited method
1 parent a20eb28 commit 08d3e94

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

Content/Scripts/uclass.js

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,26 @@
66
function isClass (thing) {
77
return typeof thing === 'function' && !thing.hasOwnProperty('arguments')
88
}
9+
10+
function getOwnPropertyNames (proto, stop) {
11+
let props = new Set();
12+
while (proto && proto !== stop) {
13+
Object.getOwnPropertyNames(proto).filter(name => {
14+
let c = Object.getOwnPropertyDescriptor(proto, name);
15+
return (c.get || c.set) == undefined;
16+
}).forEach(name => {
17+
props.add(name);
18+
});
19+
20+
let parentClass = Object.getPrototypeOf(proto).constructor;
21+
if (!isClass(parentClass) || parentClass == Object) {
22+
break;
23+
}
24+
proto = Object.getPrototypeOf (proto);
25+
}
26+
return [...props];
27+
}
28+
929
module.exports = function () {
1030
let mod_patterns = {
1131
bCtrl: /^ctrl$/i,
@@ -153,11 +173,7 @@
153173
}
154174

155175
let proxy = {}
156-
_(Object.getOwnPropertyNames(template.prototype)).filter((name) => {
157-
let c = Object.getOwnPropertyDescriptor(template.prototype, name);
158-
return (c.get || c.set) == undefined;
159-
})
160-
.forEach((k) => {
176+
_(getOwnPropertyNames(template.prototype)).forEach((k) => {
161177
if (k == "properties") {
162178
let func = String(template.prototype[k])
163179
func = func.substr(func.indexOf('{')+1)

0 commit comments

Comments
 (0)