-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
26 lines (23 loc) · 723 Bytes
/
index.js
File metadata and controls
26 lines (23 loc) · 723 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
module.exports = function(args,parent) {
var constructor = args.initialize || function () {};
if (parent) {
constructor.prototype = new parent();
}
constructor.__super__ = parent || Object;
constructor.prototype.constructor = constructor;
for(var i in args) {
if (args[i].hasOwnProperty && typeof args[i] == 'function' &&
i != 'initialize') {
constructor.prototype[i] = args[i];
}
}
var current = constructor
constructor.prototype.super = function(method) {
current = current.__super__;
var result = current.prototype[method].apply(this, [].slice.call(arguments, 1));
// set current back
current = constructor;
return result;
};
return constructor;
};