forked from Joose/Joose
/
Object.js
60 lines (36 loc) · 1.33 KB
/
Object.js
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
(function () {
Joose.Proto.Object = function () {
throw "Joose.Proto.Object can't be instantiated"
}
var SUPER = function () {
var self = SUPER.caller
if (self == SUPERARG) self = self.caller
if (!self.SUPER) throw "Invalid call to SUPER"
return self.SUPER[self.methodName].apply(this, arguments)
}
var SUPERARG = function () {
return this.SUPER.apply(this, arguments[0])
}
Joose.Proto.Object.prototype = {
SUPERARG : SUPERARG,
SUPER : SUPER,
INNER : function () {
throw "Invalid call to INNER"
},
BUILD : function (config) {
return arguments.length == 1 && typeof config == 'object' && config || {}
},
initialize: function (props) {
Joose.O.copyOwn(props, this)
},
toString: function () {
return "a " + this.meta.name
}
}
Joose.Proto.Object.meta = {
constructor : Joose.Proto.Object,
methods : Joose.O.copy(Joose.Proto.Object.prototype),
attributes : {}
}
Joose.Proto.Object.prototype.meta = Joose.Proto.Object.meta
})()