Skip to content

Commit

Permalink
fix(core): Return the window object as default instead of the boolean…
Browse files Browse the repository at this point in the history
… from the typeof comparison (#3160)

* Fixes #2972

#2972

* If window does not exist.

But is there a case where window does not exist? If ionic-native always runs in browsers enviroment (like Cordova / WebView) we could remove the `typeof` checks.
  • Loading branch information
Domvel authored and danielsogl committed Sep 13, 2019
1 parent 2b347fe commit 8b3b2a4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/@ionic-native/core/decorators/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ function wrapObservable(pluginObj: any, methodName: string, args: any[], opts: a
* @returns {Observable}
*/
function wrapEventObservable(event: string, element: any): Observable<any> {
element = (typeof window !== 'undefined' && element) ? get(window, element) : element || typeof window !== 'undefined' || {};
element = (typeof window !== 'undefined' && element) ? get(window, element) : element || (typeof window !== 'undefined' ? window : {});
return fromEvent(element, event);
}

Expand Down

0 comments on commit 8b3b2a4

Please sign in to comment.