Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v4 beta-13] On cordova resume event, angular/src/util/util.js fails #15944

Closed
MarkChrisLevy opened this issue Oct 15, 2018 · 1 comment
Closed
Labels

Comments

@MarkChrisLevy
Copy link
Contributor

Bug Report

Ionic Info
Run ionic info from a terminal/cmd prompt and paste the output below.

@ionic/angular 4.0.0-beta13

Describe the Bug
When using cordova browser, util/util.js proxyEvent fails when on resume event is fired.

util.js:10 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:1508)

zrzut ekranu 2018-10-15 o 07 57 07

@manucorporat made changes to util.js, adding support for back button event and it is missing the check if event isn't undefined/null, which for some reasons is the case for on resume. So the fix is very simple:

export function proxyEvent<T>(emitter: EventEmitter<T>, el: EventTarget, eventName: string) {
 el.addEventListener(eventName, (ev) => {
  emitter.emit(ev ? (ev as any).detail as T : undefined);
  });
}	

Steps to Reproduce
Steps to reproduce the behavior:

  1. Load the web app, which uses cordova browser
  2. open another tab
  3. go back to the tab with the web app - the error is thrown

Expected Behavior
No error obviously.

@ionitron-bot ionitron-bot bot added the triage label Oct 15, 2018
@MarkChrisLevy MarkChrisLevy changed the title On cordova resume event, angular/src/util/util.js fails [v4 beta-13] On cordova resume event, angular/src/util/util.js fails Oct 15, 2018
@ionitron-bot
Copy link

ionitron-bot bot commented Nov 22, 2018

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Nov 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant