From e735d2cbd1401c92d0386a91d7f7e71c7475c55a Mon Sep 17 00:00:00 2001 From: Mark Levy Date: Wed, 19 Dec 2018 13:35:28 +0100 Subject: [PATCH] fix(angular): Fix cordova browser error when resumed (#16810) * fix cordova resume error In cordova browser error is thrown everytime tab/window is reactivated: Uncaught TypeError: Cannot read property 'detail' of undefined at Channel. (util.js:10) at Channel.fire (cordova.js:798) at HTMLDocument. (cordova.js:1511) That was fixed in previous commits, by in latest was reintroduced again. * update types --- angular/src/util/util.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/angular/src/util/util.ts b/angular/src/util/util.ts index dd5c95fe4f..0028cd0323 100644 --- a/angular/src/util/util.ts +++ b/angular/src/util/util.ts @@ -10,8 +10,9 @@ export function inputs(instance: any, el: ElementRef, props: string[]) { } export function proxyEvent(emitter: Subject, el: EventTarget, eventName: string) { - el.addEventListener(eventName, ev => { - emitter.next((ev as any).detail as T); + el.addEventListener(eventName, (ev: Event | undefined | null) => { + // ?? cordova might emit "null" events + emitter.next(ev != null ? (ev as any).detail as T : undefined); }); }