mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
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.<anonymous> (util.js:10) at Channel.fire (cordova.js:798) at HTMLDocument.<anonymous> (cordova.js:1511) That was fixed in previous commits, by in latest was reintroduced again. * update types
This commit is contained in:
@ -10,8 +10,9 @@ export function inputs(instance: any, el: ElementRef, props: string[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function proxyEvent<T>(emitter: Subject<T>, el: EventTarget, eventName: string) {
|
export function proxyEvent<T>(emitter: Subject<T>, el: EventTarget, eventName: string) {
|
||||||
el.addEventListener(eventName, ev => {
|
el.addEventListener(eventName, (ev: Event | undefined | null) => {
|
||||||
emitter.next((ev as any).detail as T);
|
// ?? cordova might emit "null" events
|
||||||
|
emitter.next(ev != null ? (ev as any).detail as T : undefined);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user