We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 517104f commit 7a0545dCopy full SHA for 7a0545d
angular/src/providers/events.ts
@@ -14,7 +14,7 @@ export class Events {
14
subscribe(topic: string, ...handlers: Function[]) {
15
let topics = this.c.get(topic);
16
if (!topics) {
17
- topics = [];
+ this.c.set(topic, topics = []);
18
}
19
topics.push(...handlers);
20
@@ -62,7 +62,14 @@ export class Events {
62
63
return null;
64
65
- return topics.map((handler => handler(...args)));
+ return topics.map(handler => {
66
+ try {
67
+ return handler(...args);
68
+ } catch (e) {
69
+ console.error(e);
70
+ return null;
71
+ }
72
+ });
73
74
75
0 commit comments