fix(angular): events

fixes #14866
This commit is contained in:
Manu Mtz.-Almeida
2018-07-28 17:37:47 +02:00
parent 517104fbc7
commit 7a0545d477

View File

@@ -14,7 +14,7 @@ export class Events {
subscribe(topic: string, ...handlers: Function[]) {
let topics = this.c.get(topic);
if (!topics) {
topics = [];
this.c.set(topic, topics = []);
}
topics.push(...handlers);
}
@@ -62,7 +62,14 @@ export class Events {
if (!topics) {
return null;
}
return topics.map((handler => handler(...args)));
return topics.map(handler => {
try {
return handler(...args);
} catch (e) {
console.error(e);
return null;
}
});
}
}