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

fix(in-app-browser): adds missing customscheme type #3276

Merged
merged 1 commit into from
Jan 3, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions src/@ionic-native/plugins/in-app-browser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ export interface InAppBrowserOptions {
[key: string]: any;
}

export type InAppBrowserEventType = 'loadstart' | 'loadstop' | 'loaderror' | 'exit' | 'beforeload' | 'message';
export type InAppBrowserEventType = 'loadstart' | 'loadstop' | 'loaderror' | 'exit' | 'beforeload' | 'message' | 'customscheme';

export interface InAppBrowserEvent extends Event {
/** the event name */
type: InAppBrowserEventType;
type: string;
/** the URL that was loaded. */
url: string;
/** the error code, only in the case of loaderror. */
Expand Down Expand Up @@ -248,6 +248,28 @@ export class InAppBrowserObject {
}
);
}

/**
* A method that allows you to listen to events happening in the browser.
* @param event {string} Name of the event
* @returns {Observable<InAppBrowserEvent>} Returns back an observable that will listen to the event on subscribe, and will stop listening to the event on unsubscribe.
*/
@InstanceCheck()
on(event: string): Observable<InAppBrowserEvent> {
return new Observable<InAppBrowserEvent>(
(observer: Observer<InAppBrowserEvent>) => {
this._objectInstance.addEventListener(
event,
observer.next.bind(observer)
);
return () =>
this._objectInstance.removeEventListener(
event,
observer.next.bind(observer)
);
}
);
}
}

/**
Expand Down