mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-21 08:43:01 +08:00
fix(core): Return the window object as default instead of the boolean from the typeof comparison (#3160)
* Fixes #2972 https://github.com/ionic-team/ionic-native/issues/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.
This commit is contained in:
parent
2b347fe889
commit
8b3b2a4b27
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user