assemblerjs 1.1.2 → 1.1.3
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/index.d.ts +26 -0
- package/dist/index11.js +2 -2
- package/dist/index11.mjs +2 -2
- package/dist/index13.js +2 -2
- package/dist/index13.mjs +2 -2
- 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 +2 -2
- package/dist/index22.mjs +2 -2
- package/dist/index23.js +2 -2
- package/dist/index23.mjs +2 -2
- 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/index27.js +1 -1
- package/dist/index27.mjs +1 -1
- package/dist/index29.js +15 -38
- package/dist/index29.mjs +12 -37
- package/dist/index3.js +1 -1
- package/dist/index3.mjs +1 -1
- package/dist/index30.js +100 -58
- package/dist/index30.mjs +98 -58
- package/dist/index31.js +36 -27
- package/dist/index31.mjs +35 -27
- package/dist/index32.js +16 -59
- package/dist/index32.mjs +16 -59
- package/dist/index33.js +65 -28
- package/dist/index33.mjs +65 -28
- package/dist/index34.js +28 -28
- package/dist/index34.mjs +28 -28
- package/dist/index35.js +77 -15
- package/dist/index35.mjs +77 -12
- package/dist/index36.js +38 -104
- package/dist/index36.mjs +38 -102
- package/dist/index37.js +28 -102
- package/dist/index37.mjs +28 -102
- package/dist/index38.js +128 -23
- package/dist/index38.mjs +128 -23
- package/dist/index39.js +101 -18
- package/dist/index39.mjs +101 -18
- package/dist/index4.js +21 -8
- package/dist/index4.mjs +21 -8
- package/dist/index40.js +25 -25
- package/dist/index40.mjs +25 -24
- package/dist/index41.js +44 -18
- package/dist/index41.mjs +44 -17
- package/dist/index42.js +18 -44
- package/dist/index42.mjs +17 -44
- package/dist/index43.js +26 -191
- package/dist/index43.mjs +25 -191
- package/dist/index44.js +192 -940
- package/dist/index44.mjs +192 -940
- package/dist/index45.js +942 -2
- package/dist/index45.mjs +942 -2
- package/dist/index46.js +2 -2
- package/dist/index46.mjs +2 -2
- package/dist/index47.js +2 -14
- package/dist/index47.mjs +2 -14
- package/dist/index48.js +9 -34
- package/dist/index48.mjs +9 -34
- package/dist/index49.js +32 -55
- package/dist/index49.mjs +32 -54
- package/dist/index50.js +67 -0
- package/dist/index50.mjs +62 -0
- package/package.json +1 -1
package/dist/index33.js
CHANGED
|
@@ -2,36 +2,73 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const hookManager = require('./
|
|
6
|
-
const
|
|
5
|
+
const hookManager = require('./index35.js');
|
|
6
|
+
const resolutionStrategies = require('./index43.js');
|
|
7
|
+
const debugLogger = require('./index38.js');
|
|
8
|
+
const use = require('./index42.js');
|
|
9
|
+
const inject = require('./index41.js');
|
|
10
|
+
const injectable = require('./index44.js');
|
|
7
11
|
|
|
8
|
-
class
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
if (
|
|
17
|
-
throw new Error(
|
|
12
|
+
class InjectableManager {
|
|
13
|
+
setContexts(e, t) {
|
|
14
|
+
this.privateContext = e;
|
|
15
|
+
this.publicContext = t;
|
|
16
|
+
}
|
|
17
|
+
register(r, n = false) {
|
|
18
|
+
const a = debugLogger.DebugLogger.getInstance();
|
|
19
|
+
const c = n === true ? use.resolveInstanceInjectionTuple(r) : inject.resolveInjectionTuple(r);
|
|
20
|
+
if (this.has(c.identifier)) {
|
|
21
|
+
throw new Error(`An assemblage is already registered with identifier '${c.identifier.name}'.`);
|
|
22
|
+
}
|
|
23
|
+
const l = injectable.Injectable.of(c, this.privateContext, this.publicContext);
|
|
24
|
+
a.logRegistration(l);
|
|
25
|
+
this.injectables.set(l.identifier, l);
|
|
26
|
+
if (l.concrete) {
|
|
27
|
+
hookManager.HookManager.callHook(l.concrete, 'onRegister', this.publicContext, l.configuration);
|
|
18
28
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
return l;
|
|
30
|
+
}
|
|
31
|
+
has(e) {
|
|
32
|
+
return this.injectables.has(e);
|
|
33
|
+
}
|
|
34
|
+
require(e, t) {
|
|
35
|
+
if (!this.injectables.has(e)) {
|
|
36
|
+
throw new Error(`Class with identifier '${e.name}' has not been registered or is a circular dependency.`);
|
|
37
|
+
}
|
|
38
|
+
const i = this.injectables.get(e);
|
|
39
|
+
if (i.isSingleton) {
|
|
40
|
+
return this.singletonStrategy.resolve(i, t);
|
|
41
|
+
} else {
|
|
42
|
+
return this.transientStrategy.resolve(i, t);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
concrete(e) {
|
|
46
|
+
const t = this.injectables.get(e);
|
|
47
|
+
if (t) return t.concrete;
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
tagged(...e) {
|
|
51
|
+
const t = [];
|
|
52
|
+
for (const i of e){
|
|
53
|
+
for (const [e, s] of this.injectables){
|
|
54
|
+
if (s.tags.includes(i)) t.push(s.build());
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return t;
|
|
58
|
+
}
|
|
59
|
+
dispose() {
|
|
60
|
+
for (const [e, t] of this.injectables){
|
|
61
|
+
t.dispose();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
get size() {
|
|
65
|
+
return this.injectables.size;
|
|
66
|
+
}
|
|
67
|
+
constructor(){
|
|
68
|
+
this.injectables = new Map();
|
|
69
|
+
this.singletonStrategy = new resolutionStrategies.SingletonStrategy();
|
|
70
|
+
this.transientStrategy = new resolutionStrategies.TransientStrategy();
|
|
34
71
|
}
|
|
35
72
|
}
|
|
36
73
|
|
|
37
|
-
exports.
|
|
74
|
+
exports.InjectableManager = InjectableManager;
|
package/dist/index33.mjs
CHANGED
|
@@ -1,33 +1,70 @@
|
|
|
1
|
-
import { HookManager } from './
|
|
2
|
-
import {
|
|
1
|
+
import { HookManager } from './index35.mjs';
|
|
2
|
+
import { SingletonStrategy, TransientStrategy } from './index43.mjs';
|
|
3
|
+
import { DebugLogger } from './index38.mjs';
|
|
4
|
+
import { resolveInstanceInjectionTuple } from './index42.mjs';
|
|
5
|
+
import { resolveInjectionTuple } from './index41.mjs';
|
|
6
|
+
import { Injectable } from './index44.mjs';
|
|
3
7
|
|
|
4
|
-
class
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
if (
|
|
13
|
-
throw new Error(
|
|
8
|
+
class InjectableManager {
|
|
9
|
+
setContexts(e, t) {
|
|
10
|
+
this.privateContext = e;
|
|
11
|
+
this.publicContext = t;
|
|
12
|
+
}
|
|
13
|
+
register(r, n = false) {
|
|
14
|
+
const a = DebugLogger.getInstance();
|
|
15
|
+
const c = n === true ? resolveInstanceInjectionTuple(r) : resolveInjectionTuple(r);
|
|
16
|
+
if (this.has(c.identifier)) {
|
|
17
|
+
throw new Error(`An assemblage is already registered with identifier '${c.identifier.name}'.`);
|
|
18
|
+
}
|
|
19
|
+
const l = Injectable.of(c, this.privateContext, this.publicContext);
|
|
20
|
+
a.logRegistration(l);
|
|
21
|
+
this.injectables.set(l.identifier, l);
|
|
22
|
+
if (l.concrete) {
|
|
23
|
+
HookManager.callHook(l.concrete, 'onRegister', this.publicContext, l.configuration);
|
|
14
24
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
return l;
|
|
26
|
+
}
|
|
27
|
+
has(e) {
|
|
28
|
+
return this.injectables.has(e);
|
|
29
|
+
}
|
|
30
|
+
require(e, t) {
|
|
31
|
+
if (!this.injectables.has(e)) {
|
|
32
|
+
throw new Error(`Class with identifier '${e.name}' has not been registered or is a circular dependency.`);
|
|
33
|
+
}
|
|
34
|
+
const i = this.injectables.get(e);
|
|
35
|
+
if (i.isSingleton) {
|
|
36
|
+
return this.singletonStrategy.resolve(i, t);
|
|
37
|
+
} else {
|
|
38
|
+
return this.transientStrategy.resolve(i, t);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
concrete(e) {
|
|
42
|
+
const t = this.injectables.get(e);
|
|
43
|
+
if (t) return t.concrete;
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
tagged(...e) {
|
|
47
|
+
const t = [];
|
|
48
|
+
for (const i of e){
|
|
49
|
+
for (const [e, s] of this.injectables){
|
|
50
|
+
if (s.tags.includes(i)) t.push(s.build());
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return t;
|
|
54
|
+
}
|
|
55
|
+
dispose() {
|
|
56
|
+
for (const [e, t] of this.injectables){
|
|
57
|
+
t.dispose();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
get size() {
|
|
61
|
+
return this.injectables.size;
|
|
62
|
+
}
|
|
63
|
+
constructor(){
|
|
64
|
+
this.injectables = new Map();
|
|
65
|
+
this.singletonStrategy = new SingletonStrategy();
|
|
66
|
+
this.transientStrategy = new TransientStrategy();
|
|
30
67
|
}
|
|
31
68
|
}
|
|
32
69
|
|
|
33
|
-
export {
|
|
70
|
+
export { InjectableManager };
|
package/dist/index34.js
CHANGED
|
@@ -2,36 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
class
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
dispose: this.assembler.dispose.bind(this.assembler),
|
|
13
|
-
global: this.assembler.global.bind(this.assembler),
|
|
14
|
-
on: this.assembler.on.bind(this.assembler),
|
|
15
|
-
once: this.assembler.once.bind(this.assembler),
|
|
16
|
-
off: this.assembler.off.bind(this.assembler),
|
|
17
|
-
events: this.assembler.channels
|
|
18
|
-
};
|
|
5
|
+
class ObjectManager {
|
|
6
|
+
use(e, t) {
|
|
7
|
+
if (this.has(e)) {
|
|
8
|
+
throw new Error(`A value is already registered with identifier '${String(e)}'.`);
|
|
9
|
+
}
|
|
10
|
+
this.objects.set(e, t);
|
|
11
|
+
return t;
|
|
19
12
|
}
|
|
20
|
-
|
|
21
|
-
return
|
|
22
|
-
...s,
|
|
23
|
-
register: this.assembler.register.bind(this.assembler),
|
|
24
|
-
use: this.assembler.use.bind(this.assembler),
|
|
25
|
-
addGlobal: this.assembler.addGlobal.bind(this.assembler),
|
|
26
|
-
prepareInitHook: this.assembler.prepareInitHook.bind(this.assembler),
|
|
27
|
-
emit: this.assembler.emit.bind(this.assembler),
|
|
28
|
-
addChannels: this.assembler.addChannels.bind(this.assembler),
|
|
29
|
-
removeChannels: this.assembler.removeChannels.bind(this.assembler)
|
|
30
|
-
};
|
|
13
|
+
has(e) {
|
|
14
|
+
return this.objects.has(e);
|
|
31
15
|
}
|
|
32
|
-
|
|
33
|
-
this.
|
|
16
|
+
require(e) {
|
|
17
|
+
if (!this.objects.has(e)) {
|
|
18
|
+
throw new Error(`Injected object with identifier '${String(e)}' has not been registered.`);
|
|
19
|
+
}
|
|
20
|
+
return this.objects.get(e);
|
|
21
|
+
}
|
|
22
|
+
addGlobal(e, t) {
|
|
23
|
+
if (this.globals.has(e)) {
|
|
24
|
+
throw new Error(`Global value with key '${e}' has already been registered.`);
|
|
25
|
+
}
|
|
26
|
+
this.globals.set(e, t);
|
|
27
|
+
}
|
|
28
|
+
global(e) {
|
|
29
|
+
return this.globals.get(e);
|
|
30
|
+
}
|
|
31
|
+
constructor(){
|
|
32
|
+
this.objects = new Map();
|
|
33
|
+
this.globals = new Map();
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
exports.
|
|
37
|
+
exports.ObjectManager = ObjectManager;
|
package/dist/index34.mjs
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
class
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
dispose: this.assembler.dispose.bind(this.assembler),
|
|
9
|
-
global: this.assembler.global.bind(this.assembler),
|
|
10
|
-
on: this.assembler.on.bind(this.assembler),
|
|
11
|
-
once: this.assembler.once.bind(this.assembler),
|
|
12
|
-
off: this.assembler.off.bind(this.assembler),
|
|
13
|
-
events: this.assembler.channels
|
|
14
|
-
};
|
|
1
|
+
class ObjectManager {
|
|
2
|
+
use(e, t) {
|
|
3
|
+
if (this.has(e)) {
|
|
4
|
+
throw new Error(`A value is already registered with identifier '${String(e)}'.`);
|
|
5
|
+
}
|
|
6
|
+
this.objects.set(e, t);
|
|
7
|
+
return t;
|
|
15
8
|
}
|
|
16
|
-
|
|
17
|
-
return
|
|
18
|
-
...s,
|
|
19
|
-
register: this.assembler.register.bind(this.assembler),
|
|
20
|
-
use: this.assembler.use.bind(this.assembler),
|
|
21
|
-
addGlobal: this.assembler.addGlobal.bind(this.assembler),
|
|
22
|
-
prepareInitHook: this.assembler.prepareInitHook.bind(this.assembler),
|
|
23
|
-
emit: this.assembler.emit.bind(this.assembler),
|
|
24
|
-
addChannels: this.assembler.addChannels.bind(this.assembler),
|
|
25
|
-
removeChannels: this.assembler.removeChannels.bind(this.assembler)
|
|
26
|
-
};
|
|
9
|
+
has(e) {
|
|
10
|
+
return this.objects.has(e);
|
|
27
11
|
}
|
|
28
|
-
|
|
29
|
-
this.
|
|
12
|
+
require(e) {
|
|
13
|
+
if (!this.objects.has(e)) {
|
|
14
|
+
throw new Error(`Injected object with identifier '${String(e)}' has not been registered.`);
|
|
15
|
+
}
|
|
16
|
+
return this.objects.get(e);
|
|
17
|
+
}
|
|
18
|
+
addGlobal(e, t) {
|
|
19
|
+
if (this.globals.has(e)) {
|
|
20
|
+
throw new Error(`Global value with key '${e}' has already been registered.`);
|
|
21
|
+
}
|
|
22
|
+
this.globals.set(e, t);
|
|
23
|
+
}
|
|
24
|
+
global(e) {
|
|
25
|
+
return this.globals.get(e);
|
|
26
|
+
}
|
|
27
|
+
constructor(){
|
|
28
|
+
this.objects = new Map();
|
|
29
|
+
this.globals = new Map();
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
export {
|
|
33
|
+
export { ObjectManager };
|
package/dist/index35.js
CHANGED
|
@@ -2,22 +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('./index38.js');
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
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);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
callInitedHooks(o) {
|
|
22
|
+
for (const t of [
|
|
23
|
+
...this.initCache
|
|
24
|
+
].reverse()){
|
|
25
|
+
HookManager.callHookImmediate(t.instance, 'onInited', o, t.configuration);
|
|
26
|
+
}
|
|
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
|
+
});
|
|
9
67
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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;
|
|
77
|
+
}
|
|
78
|
+
s.bind(e)(n, a);
|
|
79
|
+
if (r) r();
|
|
80
|
+
} else {
|
|
81
|
+
if (r) r();
|
|
82
|
+
}
|
|
18
83
|
};
|
|
19
84
|
|
|
20
|
-
exports.
|
|
21
|
-
exports.getCustomMetadata = getCustomMetadata;
|
|
22
|
-
exports.getOwnCustomMetadata = getOwnCustomMetadata;
|
|
23
|
-
exports.getParamTypes = getParamTypes;
|
|
85
|
+
exports.HookManager = HookManager;
|
package/dist/index35.mjs
CHANGED
|
@@ -1,16 +1,81 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isAsync } from '@assemblerjs/core';
|
|
2
|
+
import { DebugLogger } from './index38.mjs';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
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);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
callInitedHooks(o) {
|
|
18
|
+
for (const t of [
|
|
19
|
+
...this.initCache
|
|
20
|
+
].reverse()){
|
|
21
|
+
HookManager.callHookImmediate(t.instance, 'onInited', o, t.configuration);
|
|
22
|
+
}
|
|
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
|
+
});
|
|
5
63
|
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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;
|
|
73
|
+
}
|
|
74
|
+
s.bind(e)(n, a);
|
|
75
|
+
if (r) r();
|
|
76
|
+
} else {
|
|
77
|
+
if (r) r();
|
|
78
|
+
}
|
|
14
79
|
};
|
|
15
80
|
|
|
16
|
-
export {
|
|
81
|
+
export { HookManager };
|