1 |
dpavlin |
46 |
|
2 |
|
|
|
3 |
|
|
Class("Joose.Prototype", { |
4 |
|
|
isa: Joose.Class, |
5 |
|
|
override: { |
6 |
|
|
initializer: function () { |
7 |
|
|
var init = this.SUPER() |
8 |
|
|
return function () { |
9 |
|
|
init.apply(this, arguments) |
10 |
|
|
var meta = this.meta; |
11 |
|
|
this.meta = new Joose.PrototypeLazyMetaObjectProxy(); |
12 |
|
|
this.meta.metaObject = meta |
13 |
|
|
this.meta.object = this; |
14 |
|
|
} |
15 |
|
|
} |
16 |
|
|
} |
17 |
|
|
}) |
18 |
|
|
|
19 |
|
|
|
20 |
|
|
Class("Joose.PrototypeLazyMetaObjectProxy", { |
21 |
|
|
has: { |
22 |
|
|
metaObject: { |
23 |
|
|
is: rw, |
24 |
|
|
isa: Joose.Class, |
25 |
|
|
handles: "*", |
26 |
|
|
handleWith: function (name) { |
27 |
|
|
return function () { |
28 |
|
|
// when we are called, turn the objects meta object into the original, detach yourself |
29 |
|
|
// and call the original methods |
30 |
|
|
var o = this.object; |
31 |
|
|
o.meta = this.metaObject; |
32 |
|
|
o.detach() |
33 |
|
|
o.meta[name].apply(o.meta, arguments) |
34 |
|
|
} |
35 |
|
|
} |
36 |
|
|
}, |
37 |
|
|
object: { |
38 |
|
|
is: rw |
39 |
|
|
} |
40 |
|
|
} |
41 |
|
|
}) |
42 |
|
|
|
43 |
|
|
Joose.bootstrap3() |