assemblerjs 1.1.21 → 1.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index11.js +2 -2
- package/dist/index11.mjs +2 -2
- package/dist/index13.js +1 -1
- package/dist/index13.mjs +1 -1
- package/dist/index16.js +1 -1
- package/dist/index16.mjs +1 -1
- package/dist/index17.js +1 -1
- package/dist/index17.mjs +1 -1
- package/dist/index18.js +1 -1
- package/dist/index18.mjs +1 -1
- package/dist/index19.js +1 -1
- package/dist/index19.mjs +1 -1
- package/dist/index2.js +2 -2
- package/dist/index2.mjs +2 -2
- package/dist/index20.js +1 -1
- package/dist/index20.mjs +1 -1
- package/dist/index21.js +1 -1
- package/dist/index21.mjs +1 -1
- package/dist/index22.js +3 -3
- package/dist/index22.mjs +3 -3
- package/dist/index23.js +3 -3
- package/dist/index23.mjs +3 -3
- package/dist/index24.js +2 -2
- package/dist/index24.mjs +2 -2
- package/dist/index25.js +1 -1
- package/dist/index25.mjs +1 -1
- package/dist/index26.js +1 -1
- package/dist/index26.mjs +1 -1
- package/dist/index29.js +158 -17
- package/dist/index29.mjs +157 -14
- package/dist/index3.js +1 -1
- package/dist/index3.mjs +1 -1
- package/dist/index30.js +43 -100
- package/dist/index30.mjs +43 -98
- package/dist/index31.js +71 -32
- package/dist/index31.mjs +71 -31
- package/dist/index32.js +51 -154
- package/dist/index32.mjs +51 -153
- package/dist/index33.js +28 -47
- package/dist/index33.mjs +28 -47
- package/dist/index34.js +161 -65
- package/dist/index34.mjs +161 -65
- package/dist/index35.js +58 -50
- package/dist/index35.mjs +58 -50
- package/dist/index36.js +18 -32
- package/dist/index36.mjs +15 -32
- package/dist/index37.js +99 -167
- package/dist/index37.mjs +97 -167
- package/dist/index38.js +16 -57
- package/dist/index38.mjs +16 -57
- package/dist/index39.js +38 -20
- package/dist/index39.mjs +37 -20
- package/dist/index4.js +7 -7
- package/dist/index4.mjs +7 -7
- package/dist/index42.js +29 -49
- package/dist/index42.mjs +28 -49
- package/dist/index44.js +49 -29
- package/dist/index44.mjs +49 -28
- package/dist/index45.js +25 -9
- package/dist/index45.mjs +25 -9
- package/dist/index49.js +1 -1
- package/dist/index49.mjs +1 -1
- package/dist/index50.js +1 -1
- package/dist/index50.mjs +1 -1
- package/dist/index51.js +1 -1
- package/dist/index51.mjs +1 -1
- package/package.json +1 -1
package/dist/index3.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReflectFlags, ReflectValue } from './index28.mjs';
|
|
2
|
-
import { getOwnCustomMetadata } from './
|
|
2
|
+
import { getOwnCustomMetadata } from './index36.mjs';
|
|
3
3
|
|
|
4
4
|
const isAssemblage = (s)=>{
|
|
5
5
|
return getOwnCustomMetadata(ReflectFlags.IsAssemblage, s) || false;
|
package/dist/index30.js
CHANGED
|
@@ -2,112 +2,55 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
const reflection = require('./index29.js');
|
|
7
|
-
const helpers = require('./index3.js');
|
|
5
|
+
const debugLogger = require('./index34.js');
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
function t(e) {
|
|
8
|
+
return typeof e === 'symbol' ? 'symbol' : 'string';
|
|
9
|
+
}
|
|
10
|
+
class ObjectManager {
|
|
11
|
+
use(r, o) {
|
|
12
|
+
if (this.has(r)) {
|
|
13
|
+
const o = typeof r === 'symbol' ? r.toString() : String(r);
|
|
14
|
+
const s = `Object/value '${o}' is already registered (cannot register twice).`;
|
|
15
|
+
debugLogger.DebugLogger.getInstance().log('error', 'Duplicate object/value registration', {
|
|
16
|
+
identifier: o,
|
|
17
|
+
type: t(r),
|
|
18
|
+
error: s
|
|
19
|
+
});
|
|
20
|
+
throw new Error(s);
|
|
17
21
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
test: (r)=>typeof r === 'undefined' || Array.isArray(r) && r.every((r)=>typeof r === 'string'),
|
|
21
|
-
throw: ()=>{
|
|
22
|
-
throw new Error(`'events' property must be an array of strings or 'undefined'.`);
|
|
23
|
-
},
|
|
24
|
-
transform: (r)=>r
|
|
25
|
-
},
|
|
26
|
-
inject: {
|
|
27
|
-
test: (r)=>typeof r === 'undefined' || Array.isArray(r) && r.every((r)=>Array.isArray(r) && r.length >= 1 && r.length <= 3),
|
|
28
|
-
throw: ()=>{
|
|
29
|
-
throw new Error(`'inject' property must be an array of tuples of length 1, 2 or 3.`);
|
|
30
|
-
},
|
|
31
|
-
transform: (r)=>r
|
|
32
|
-
},
|
|
33
|
-
use: {
|
|
34
|
-
test: (r)=>typeof r === 'undefined' || Array.isArray(r) && r.every((r)=>{
|
|
35
|
-
if (!Array.isArray(r) || r.length !== 2) {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
const e = r[1];
|
|
39
|
-
return typeof e !== 'undefined';
|
|
40
|
-
}),
|
|
41
|
-
throw: ()=>{
|
|
42
|
-
throw new Error(`'use' property must be an array of tuples of length 2 with [identifier, instance | factory].`);
|
|
43
|
-
},
|
|
44
|
-
transform: (r)=>r
|
|
45
|
-
},
|
|
46
|
-
engage: {
|
|
47
|
-
test: (r)=>typeof r === 'undefined' || Array.isArray(r) && r.every((r)=>Array.isArray(r) && r.length >= 1 && r.length <= 3),
|
|
48
|
-
throw: ()=>{
|
|
49
|
-
throw new Error(`'engage' property must be an array of tuples of length 1, 2 or 3.`);
|
|
50
|
-
},
|
|
51
|
-
transform: (r)=>r
|
|
52
|
-
},
|
|
53
|
-
tags: {
|
|
54
|
-
test: (r)=>typeof r === 'undefined' || typeof r === 'string' || Array.isArray(r) && r.every((r)=>typeof r === 'string'),
|
|
55
|
-
throw: ()=>{
|
|
56
|
-
throw new Error(`'tags' property must be a string or an array of strings.`);
|
|
57
|
-
},
|
|
58
|
-
transform: (r)=>typeof r === 'string' ? [
|
|
59
|
-
r
|
|
60
|
-
] : r
|
|
61
|
-
},
|
|
62
|
-
metadata: {
|
|
63
|
-
test: (r)=>(typeof r === 'object' || typeof r === 'undefined') && !Array.isArray(r),
|
|
64
|
-
throw: ()=>{
|
|
65
|
-
throw new Error(`'metadata' property must be of type 'object' or 'undefined'.`);
|
|
66
|
-
},
|
|
67
|
-
transform: (r)=>r
|
|
68
|
-
},
|
|
69
|
-
global: {
|
|
70
|
-
test: (r)=>(typeof r === 'object' || typeof r === 'undefined') && !Array.isArray(r),
|
|
71
|
-
throw: ()=>{
|
|
72
|
-
throw new Error(`'global' property must be of type 'object' or 'undefined'.`);
|
|
73
|
-
},
|
|
74
|
-
transform: (r)=>r
|
|
22
|
+
this.objects.set(r, o);
|
|
23
|
+
return o;
|
|
75
24
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
25
|
+
has(e) {
|
|
26
|
+
return this.objects.has(e);
|
|
27
|
+
}
|
|
28
|
+
require(r) {
|
|
29
|
+
if (!this.objects.has(r)) {
|
|
30
|
+
const o = typeof r === 'symbol' ? r.toString() : String(r);
|
|
31
|
+
const s = `Object/value '${o}' has not been registered in the object store.`;
|
|
32
|
+
debugLogger.DebugLogger.getInstance().log('error', 'Object/value not found', {
|
|
33
|
+
identifier: o,
|
|
34
|
+
type: t(r),
|
|
35
|
+
error: s
|
|
36
|
+
});
|
|
37
|
+
throw new Error(s);
|
|
84
38
|
}
|
|
39
|
+
return this.objects.get(r);
|
|
85
40
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
const s = n[r].transform;
|
|
90
|
-
if (!t(e[r])) {
|
|
91
|
-
o();
|
|
41
|
+
addGlobal(e, t) {
|
|
42
|
+
if (this.globals.has(e)) {
|
|
43
|
+
throw new Error(`Global value with key '${e}' has already been registered.`);
|
|
92
44
|
}
|
|
93
|
-
e
|
|
45
|
+
this.globals.set(e, t);
|
|
46
|
+
}
|
|
47
|
+
global(e) {
|
|
48
|
+
return this.globals.get(e);
|
|
94
49
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
if (!helpers.isAssemblage(e)) {
|
|
99
|
-
throw new Error(`Class '${e.name}' is not an assemblage or transversal.`);
|
|
50
|
+
constructor(){
|
|
51
|
+
this.objects = new Map();
|
|
52
|
+
this.globals = new Map();
|
|
100
53
|
}
|
|
101
|
-
|
|
102
|
-
};
|
|
103
|
-
const setDefinitionValue = (t, o, n)=>{
|
|
104
|
-
const s = getDefinition(n);
|
|
105
|
-
s[t] = o;
|
|
106
|
-
const a = validateDefinition(s);
|
|
107
|
-
reflection.defineCustomMetadata(constants.ReflectValue.AssemblageDefinition, a, n);
|
|
108
|
-
return a;
|
|
109
|
-
};
|
|
54
|
+
}
|
|
110
55
|
|
|
111
|
-
exports.
|
|
112
|
-
exports.setDefinitionValue = setDefinitionValue;
|
|
113
|
-
exports.validateDefinition = validateDefinition;
|
|
56
|
+
exports.ObjectManager = ObjectManager;
|
package/dist/index30.mjs
CHANGED
|
@@ -1,107 +1,52 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getOwnCustomMetadata, defineCustomMetadata } from './index29.mjs';
|
|
3
|
-
import { isAssemblage } from './index3.mjs';
|
|
1
|
+
import { DebugLogger } from './index34.mjs';
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
function t(e) {
|
|
4
|
+
return typeof e === 'symbol' ? 'symbol' : 'string';
|
|
5
|
+
}
|
|
6
|
+
class ObjectManager {
|
|
7
|
+
use(r, o) {
|
|
8
|
+
if (this.has(r)) {
|
|
9
|
+
const o = typeof r === 'symbol' ? r.toString() : String(r);
|
|
10
|
+
const s = `Object/value '${o}' is already registered (cannot register twice).`;
|
|
11
|
+
DebugLogger.getInstance().log('error', 'Duplicate object/value registration', {
|
|
12
|
+
identifier: o,
|
|
13
|
+
type: t(r),
|
|
14
|
+
error: s
|
|
15
|
+
});
|
|
16
|
+
throw new Error(s);
|
|
13
17
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
test: (r)=>typeof r === 'undefined' || Array.isArray(r) && r.every((r)=>typeof r === 'string'),
|
|
17
|
-
throw: ()=>{
|
|
18
|
-
throw new Error(`'events' property must be an array of strings or 'undefined'.`);
|
|
19
|
-
},
|
|
20
|
-
transform: (r)=>r
|
|
21
|
-
},
|
|
22
|
-
inject: {
|
|
23
|
-
test: (r)=>typeof r === 'undefined' || Array.isArray(r) && r.every((r)=>Array.isArray(r) && r.length >= 1 && r.length <= 3),
|
|
24
|
-
throw: ()=>{
|
|
25
|
-
throw new Error(`'inject' property must be an array of tuples of length 1, 2 or 3.`);
|
|
26
|
-
},
|
|
27
|
-
transform: (r)=>r
|
|
28
|
-
},
|
|
29
|
-
use: {
|
|
30
|
-
test: (r)=>typeof r === 'undefined' || Array.isArray(r) && r.every((r)=>{
|
|
31
|
-
if (!Array.isArray(r) || r.length !== 2) {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
const e = r[1];
|
|
35
|
-
return typeof e !== 'undefined';
|
|
36
|
-
}),
|
|
37
|
-
throw: ()=>{
|
|
38
|
-
throw new Error(`'use' property must be an array of tuples of length 2 with [identifier, instance | factory].`);
|
|
39
|
-
},
|
|
40
|
-
transform: (r)=>r
|
|
41
|
-
},
|
|
42
|
-
engage: {
|
|
43
|
-
test: (r)=>typeof r === 'undefined' || Array.isArray(r) && r.every((r)=>Array.isArray(r) && r.length >= 1 && r.length <= 3),
|
|
44
|
-
throw: ()=>{
|
|
45
|
-
throw new Error(`'engage' property must be an array of tuples of length 1, 2 or 3.`);
|
|
46
|
-
},
|
|
47
|
-
transform: (r)=>r
|
|
48
|
-
},
|
|
49
|
-
tags: {
|
|
50
|
-
test: (r)=>typeof r === 'undefined' || typeof r === 'string' || Array.isArray(r) && r.every((r)=>typeof r === 'string'),
|
|
51
|
-
throw: ()=>{
|
|
52
|
-
throw new Error(`'tags' property must be a string or an array of strings.`);
|
|
53
|
-
},
|
|
54
|
-
transform: (r)=>typeof r === 'string' ? [
|
|
55
|
-
r
|
|
56
|
-
] : r
|
|
57
|
-
},
|
|
58
|
-
metadata: {
|
|
59
|
-
test: (r)=>(typeof r === 'object' || typeof r === 'undefined') && !Array.isArray(r),
|
|
60
|
-
throw: ()=>{
|
|
61
|
-
throw new Error(`'metadata' property must be of type 'object' or 'undefined'.`);
|
|
62
|
-
},
|
|
63
|
-
transform: (r)=>r
|
|
64
|
-
},
|
|
65
|
-
global: {
|
|
66
|
-
test: (r)=>(typeof r === 'object' || typeof r === 'undefined') && !Array.isArray(r),
|
|
67
|
-
throw: ()=>{
|
|
68
|
-
throw new Error(`'global' property must be of type 'object' or 'undefined'.`);
|
|
69
|
-
},
|
|
70
|
-
transform: (r)=>r
|
|
18
|
+
this.objects.set(r, o);
|
|
19
|
+
return o;
|
|
71
20
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
21
|
+
has(e) {
|
|
22
|
+
return this.objects.has(e);
|
|
23
|
+
}
|
|
24
|
+
require(r) {
|
|
25
|
+
if (!this.objects.has(r)) {
|
|
26
|
+
const o = typeof r === 'symbol' ? r.toString() : String(r);
|
|
27
|
+
const s = `Object/value '${o}' has not been registered in the object store.`;
|
|
28
|
+
DebugLogger.getInstance().log('error', 'Object/value not found', {
|
|
29
|
+
identifier: o,
|
|
30
|
+
type: t(r),
|
|
31
|
+
error: s
|
|
32
|
+
});
|
|
33
|
+
throw new Error(s);
|
|
80
34
|
}
|
|
35
|
+
return this.objects.get(r);
|
|
81
36
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const s = n[r].transform;
|
|
86
|
-
if (!t(e[r])) {
|
|
87
|
-
o();
|
|
37
|
+
addGlobal(e, t) {
|
|
38
|
+
if (this.globals.has(e)) {
|
|
39
|
+
throw new Error(`Global value with key '${e}' has already been registered.`);
|
|
88
40
|
}
|
|
89
|
-
e
|
|
41
|
+
this.globals.set(e, t);
|
|
42
|
+
}
|
|
43
|
+
global(e) {
|
|
44
|
+
return this.globals.get(e);
|
|
90
45
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
if (!isAssemblage(e)) {
|
|
95
|
-
throw new Error(`Class '${e.name}' is not an assemblage or transversal.`);
|
|
46
|
+
constructor(){
|
|
47
|
+
this.objects = new Map();
|
|
48
|
+
this.globals = new Map();
|
|
96
49
|
}
|
|
97
|
-
|
|
98
|
-
};
|
|
99
|
-
const setDefinitionValue = (t, o, n)=>{
|
|
100
|
-
const s = getDefinition(n);
|
|
101
|
-
s[t] = o;
|
|
102
|
-
const a = validateDefinition(s);
|
|
103
|
-
defineCustomMetadata(ReflectValue.AssemblageDefinition, a, n);
|
|
104
|
-
return a;
|
|
105
|
-
};
|
|
50
|
+
}
|
|
106
51
|
|
|
107
|
-
export {
|
|
52
|
+
export { ObjectManager };
|
package/dist/index31.js
CHANGED
|
@@ -2,45 +2,84 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const core = require('@assemblerjs/core');
|
|
6
|
+
const debugLogger = require('./index34.js');
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
for (const
|
|
17
|
-
|
|
18
|
-
t.privateContext.emit(e, ...n);
|
|
19
|
-
});
|
|
8
|
+
class HookManager {
|
|
9
|
+
prepareInitHook(o, t) {
|
|
10
|
+
this.initCache.push({
|
|
11
|
+
instance: o,
|
|
12
|
+
configuration: t
|
|
13
|
+
});
|
|
14
|
+
return this.initCache;
|
|
15
|
+
}
|
|
16
|
+
callInitHooks(o) {
|
|
17
|
+
for (const t of this.initCache){
|
|
18
|
+
HookManager.callHookImmediate(t.instance, 'onInit', o, t.configuration);
|
|
20
19
|
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
}
|
|
21
|
+
callInitedHooks(o) {
|
|
22
|
+
for (const t of [
|
|
23
|
+
...this.initCache
|
|
24
|
+
].reverse()){
|
|
25
|
+
HookManager.callHookImmediate(t.instance, 'onInited', o, t.configuration);
|
|
24
26
|
}
|
|
25
27
|
}
|
|
28
|
+
clearCache() {
|
|
29
|
+
this.initCache.length = 0;
|
|
30
|
+
}
|
|
31
|
+
getCache() {
|
|
32
|
+
return this.initCache;
|
|
33
|
+
}
|
|
34
|
+
constructor(){
|
|
35
|
+
this.initCache = [];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
HookManager.callHook = (e, i, n, a)=>{
|
|
39
|
+
const c = debugLogger.DebugLogger.getInstance();
|
|
40
|
+
const r = c.logHook(i, e, a);
|
|
41
|
+
return new Promise((t, c)=>{
|
|
42
|
+
const s = e[i];
|
|
43
|
+
if (s) {
|
|
44
|
+
if (core.isAsync(s)) {
|
|
45
|
+
s.bind(e)(n, a).then(()=>{
|
|
46
|
+
if (r) r();
|
|
47
|
+
t();
|
|
48
|
+
}).catch((o)=>{
|
|
49
|
+
if (r) r();
|
|
50
|
+
c(o);
|
|
51
|
+
});
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
s.bind(e)(n, a);
|
|
56
|
+
if (r) r();
|
|
57
|
+
t();
|
|
58
|
+
} catch (o) {
|
|
59
|
+
if (r) r();
|
|
60
|
+
c(o);
|
|
61
|
+
}
|
|
62
|
+
} else {
|
|
63
|
+
if (r) r();
|
|
64
|
+
t();
|
|
65
|
+
}
|
|
66
|
+
});
|
|
26
67
|
};
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
68
|
+
HookManager.callHookImmediate = (e, i, n, a)=>{
|
|
69
|
+
const c = debugLogger.DebugLogger.getInstance();
|
|
70
|
+
const r = c.logHook(i, e, a);
|
|
71
|
+
const s = e[i];
|
|
72
|
+
if (s) {
|
|
73
|
+
if (core.isAsync(s)) {
|
|
74
|
+
s.bind(e)(n, a).catch(()=>{});
|
|
75
|
+
if (r) r();
|
|
76
|
+
return;
|
|
33
77
|
}
|
|
34
|
-
|
|
35
|
-
|
|
78
|
+
s.bind(e)(n, a);
|
|
79
|
+
if (r) r();
|
|
36
80
|
} else {
|
|
37
|
-
|
|
38
|
-
if (t.privateContext.events.has(e)) {
|
|
39
|
-
t.privateContext.removeChannels(e);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
81
|
+
if (r) r();
|
|
42
82
|
}
|
|
43
83
|
};
|
|
44
84
|
|
|
45
|
-
exports.
|
|
46
|
-
exports.unregisterEvents = unregisterEvents;
|
|
85
|
+
exports.HookManager = HookManager;
|
package/dist/index31.mjs
CHANGED
|
@@ -1,41 +1,81 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isAsync } from '@assemblerjs/core';
|
|
2
|
+
import { DebugLogger } from './index34.mjs';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
for (const
|
|
13
|
-
|
|
14
|
-
t.privateContext.emit(e, ...n);
|
|
15
|
-
});
|
|
4
|
+
class HookManager {
|
|
5
|
+
prepareInitHook(o, t) {
|
|
6
|
+
this.initCache.push({
|
|
7
|
+
instance: o,
|
|
8
|
+
configuration: t
|
|
9
|
+
});
|
|
10
|
+
return this.initCache;
|
|
11
|
+
}
|
|
12
|
+
callInitHooks(o) {
|
|
13
|
+
for (const t of this.initCache){
|
|
14
|
+
HookManager.callHookImmediate(t.instance, 'onInit', o, t.configuration);
|
|
16
15
|
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
}
|
|
17
|
+
callInitedHooks(o) {
|
|
18
|
+
for (const t of [
|
|
19
|
+
...this.initCache
|
|
20
|
+
].reverse()){
|
|
21
|
+
HookManager.callHookImmediate(t.instance, 'onInited', o, t.configuration);
|
|
20
22
|
}
|
|
21
23
|
}
|
|
24
|
+
clearCache() {
|
|
25
|
+
this.initCache.length = 0;
|
|
26
|
+
}
|
|
27
|
+
getCache() {
|
|
28
|
+
return this.initCache;
|
|
29
|
+
}
|
|
30
|
+
constructor(){
|
|
31
|
+
this.initCache = [];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
HookManager.callHook = (e, i, n, a)=>{
|
|
35
|
+
const c = DebugLogger.getInstance();
|
|
36
|
+
const r = c.logHook(i, e, a);
|
|
37
|
+
return new Promise((t, c)=>{
|
|
38
|
+
const s = e[i];
|
|
39
|
+
if (s) {
|
|
40
|
+
if (isAsync(s)) {
|
|
41
|
+
s.bind(e)(n, a).then(()=>{
|
|
42
|
+
if (r) r();
|
|
43
|
+
t();
|
|
44
|
+
}).catch((o)=>{
|
|
45
|
+
if (r) r();
|
|
46
|
+
c(o);
|
|
47
|
+
});
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
try {
|
|
51
|
+
s.bind(e)(n, a);
|
|
52
|
+
if (r) r();
|
|
53
|
+
t();
|
|
54
|
+
} catch (o) {
|
|
55
|
+
if (r) r();
|
|
56
|
+
c(o);
|
|
57
|
+
}
|
|
58
|
+
} else {
|
|
59
|
+
if (r) r();
|
|
60
|
+
t();
|
|
61
|
+
}
|
|
62
|
+
});
|
|
22
63
|
};
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
64
|
+
HookManager.callHookImmediate = (e, i, n, a)=>{
|
|
65
|
+
const c = DebugLogger.getInstance();
|
|
66
|
+
const r = c.logHook(i, e, a);
|
|
67
|
+
const s = e[i];
|
|
68
|
+
if (s) {
|
|
69
|
+
if (isAsync(s)) {
|
|
70
|
+
s.bind(e)(n, a).catch(()=>{});
|
|
71
|
+
if (r) r();
|
|
72
|
+
return;
|
|
29
73
|
}
|
|
30
|
-
|
|
31
|
-
|
|
74
|
+
s.bind(e)(n, a);
|
|
75
|
+
if (r) r();
|
|
32
76
|
} else {
|
|
33
|
-
|
|
34
|
-
if (t.privateContext.events.has(e)) {
|
|
35
|
-
t.privateContext.removeChannels(e);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
77
|
+
if (r) r();
|
|
38
78
|
}
|
|
39
79
|
};
|
|
40
80
|
|
|
41
|
-
export {
|
|
81
|
+
export { HookManager };
|