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

InAppBrowserEvent declaration missing #3244

Comments

@eyecatchup
Copy link

eyecatchup commented Nov 29, 2019

I'm submitting a ...
[x] bug report

Current behavior:
The following code will throw a Property 'data' does not exist on type 'InAppBrowserEvent' error

this.iabRef.on('message').subscribe((event) => {
  let data = event.data;
});

The data property is available since the postMessage implementation starting in InAppBrowser version 3.1.0.

Expected behavior:
Property data needs to be defined here: https://github.com/ionic-team/ionic-native/blob/master/src/%40ionic-native/plugins/in-app-browser/index.ts#L128

Something like:

export interface InAppBrowserEvent extends Event {
    /** the event name */
    type: InAppBrowserEventType;
    /** the URL that was loaded. */
    url: string;
    /** the error code, only in the case of loaderror. */
    code: number;
    /** the error message, only in the case of loaderror. */
    message: string;
    /** the postMessage data, only in the case of message. */
    data: any;
}

Steps to reproduce:
Ionic code:

this.iabRef.on('message').subscribe((event) => {
  let data = event.data;
});
this.iabRef.executeScript({
  code: "webkit.messageHandlers.cordova_iab.postMessage(JSON.stringify({'foo': 'bar'}))"
});

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):


Ionic:

   Ionic CLI                     : 5.4.6 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.11.5
   @angular-devkit/build-angular : 0.801.3
   @angular-devkit/schematics    : 8.1.3
   @angular/cli                  : 8.1.3
   @ionic/angular-toolkit        : 2.1.1

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : android 8.1.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 9 other plugins)

Utility:

   cordova-res : 0.8.1
   native-run  : 0.2.9

System:

   Android SDK Tools : 26.1.1 (/Users/schmitzst/Library/Android/sdk/)
   NodeJS            : v10.17.0 (/usr/local/Cellar/node@10/10.17.0/bin/node)
   npm               : 6.11.3
   OS                : macOS Catalina
   Xcode             : Xcode 11.2.1 Build version 11B500

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment