annotate core/src/js/declare/override.js @ 31:40d2e49a7219

working on dependencies
author cin
date Wed, 27 Jun 2018 04:31:39 +0300
parents acdcdf1a8d21
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
1 "use strict";
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
2 define([], function () {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
3 var slice = Array.prototype.slice;
5
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
4 var override = function (method) {
0
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
5 var proxy;
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
6
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
7 /** @this target object */
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
8 proxy = function () {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
9 var me = this;
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
10 var inherited = (this.getInherited && this.getInherited(proxy.nom, {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
11 callee: proxy
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
12 })) || function () {};
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
13
5
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
14 return method.apply(me, [function () {
0
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
15 return inherited.apply(me, arguments);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
16 }].concat(slice.apply(arguments)));
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
17 };
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
18
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
19 proxy.method = method;
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
20 proxy.overrides = true;
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
21
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
22 return proxy;
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
23 };
5
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
24
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
25 override.before = function (method) {
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
26 var proxy;
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
27
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
28 /** @this target object */
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
29 proxy = function () {
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
30 var me = this;
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
31 var inherited = (this.getInherited && this.getInherited(proxy.nom, {
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
32 callee: proxy
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
33 })) || function () {};
6
9663631cbdb9 fix implab/declare/override
cin
parents: 5
diff changeset
34
9663631cbdb9 fix implab/declare/override
cin
parents: 5
diff changeset
35
5
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
36 method.apply(me, arguments);
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
37 return inherited.apply(me, arguments);
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
38 };
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
39
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
40 proxy.method = method;
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
41 proxy.overrides = true;
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
42
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
43 return proxy;
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
44 };
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
45
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
46 override.after = function (method) {
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
47 var proxy;
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
48
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
49 /** @this target object */
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
50 proxy = function () {
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
51 var me = this;
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
52 var inherited = (this.getInherited && this.getInherited(proxy.nom, {
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
53 callee: proxy
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
54 })) || function () {};
6
9663631cbdb9 fix implab/declare/override
cin
parents: 5
diff changeset
55
5
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
56 inherited.apply(me, arguments);
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
57
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
58 return method.apply(me, arguments);
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
59 };
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
60
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
61 proxy.method = method;
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
62 proxy.overrides = true;
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
63
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
64 return proxy;
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
65 };
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
66
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
67 override.hide = function (method) {
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
68 method.overrides = false;
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
69 return method;
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
70 };
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
71
3d124d0b9078 improved declare/override, added override.before, override.after, override.hide,
cin
parents: 0
diff changeset
72 return override;
0
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
73 });