@abaplint/runtime 2.13.53 → 2.13.54
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.
|
@@ -13,13 +13,13 @@ class ABAPEventing {
|
|
|
13
13
|
if (!this.registrations[event.EVENT_CLASS][event.EVENT_NAME]) {
|
|
14
14
|
this.registrations[event.EVENT_CLASS][event.EVENT_NAME] = [];
|
|
15
15
|
}
|
|
16
|
-
const
|
|
16
|
+
const target = forObject === "ALL" ? "ALL" : forObject.get();
|
|
17
17
|
const handlers = this.registrations[event.EVENT_CLASS][event.EVENT_NAME];
|
|
18
18
|
if (activation === true) {
|
|
19
19
|
// todo: tackle duplicates
|
|
20
20
|
handlers.push({
|
|
21
21
|
handlers: methods,
|
|
22
|
-
forObject:
|
|
22
|
+
forObject: target === "ALL" ? "ALL" : new WeakRef(target),
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
else {
|
|
@@ -27,7 +27,12 @@ class ABAPEventing {
|
|
|
27
27
|
throw new Error("ABAPEventing.setHandler: deactivation of multiple methods not supported, todo");
|
|
28
28
|
}
|
|
29
29
|
// todo: comparing the functions via toString might give the wrong result
|
|
30
|
-
const index = handlers.findIndex(handler =>
|
|
30
|
+
const index = handlers.findIndex(handler => {
|
|
31
|
+
const sameObject = handler.forObject === "ALL"
|
|
32
|
+
? target === "ALL"
|
|
33
|
+
: target !== "ALL" && handler.forObject.deref() === target;
|
|
34
|
+
return sameObject && handler.handlers[0].toString() === methods[0].toString();
|
|
35
|
+
});
|
|
31
36
|
if (index !== -1) {
|
|
32
37
|
handlers.splice(index, 1);
|
|
33
38
|
}
|
|
@@ -45,7 +50,7 @@ class ABAPEventing {
|
|
|
45
50
|
await method(parameters);
|
|
46
51
|
}
|
|
47
52
|
}
|
|
48
|
-
else if (handler.forObject.deref() === me) {
|
|
53
|
+
else if (handler.forObject.deref() === me.get()) {
|
|
49
54
|
for (const method of handler.handlers) {
|
|
50
55
|
await method(parameters);
|
|
51
56
|
}
|