Skip to content

Commit 7a0545d

Browse files
committed
fix(angular): events
fixes #14866
1 parent 517104f commit 7a0545d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

angular/src/providers/events.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export class Events {
1414
subscribe(topic: string, ...handlers: Function[]) {
1515
let topics = this.c.get(topic);
1616
if (!topics) {
17-
topics = [];
17+
this.c.set(topic, topics = []);
1818
}
1919
topics.push(...handlers);
2020
}
@@ -62,7 +62,14 @@ export class Events {
6262
if (!topics) {
6363
return null;
6464
}
65-
return topics.map((handler => handler(...args)));
65+
return topics.map(handler => {
66+
try {
67+
return handler(...args);
68+
} catch (e) {
69+
console.error(e);
70+
return null;
71+
}
72+
});
6673
}
6774
}
6875

0 commit comments

Comments
 (0)