mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-04-13 00:00:10 +08:00
fix(ssr): fix window references
This commit is contained in:
@@ -147,7 +147,7 @@ export class Geofence extends IonicNativePlugin {
|
||||
*/
|
||||
onNotificationClicked(): Observable<any> {
|
||||
return new Observable<any>(observer => {
|
||||
window &&
|
||||
typeof window !== 'undefined' &&
|
||||
window.geofence &&
|
||||
(window.geofence.onNotificationClicked = observer.next.bind(observer));
|
||||
return () => (window.geofence.onNotificationClicked = () => {});
|
||||
|
||||
@@ -129,7 +129,9 @@ export class InAppBrowserObject {
|
||||
|
||||
this._objectInstance = cordova.InAppBrowser.open(url, target, options);
|
||||
} catch (e) {
|
||||
window.open(url, target);
|
||||
if (typeof window !== 'undefined') {
|
||||
window.open(url, target);
|
||||
}
|
||||
console.warn(
|
||||
'Native: InAppBrowser is not installed or you are running on a browser. Falling back to window.open.'
|
||||
);
|
||||
|
||||
@@ -391,7 +391,9 @@ export class PushObject {
|
||||
if (
|
||||
checkAvailability('PushNotification', 'init', 'PushNotification') === true
|
||||
) {
|
||||
this._objectInstance = window.PushNotification.init(options);
|
||||
if (typeof window !== 'undefined') {
|
||||
this._objectInstance = window.PushNotification.init(options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -85,7 +85,9 @@ export class ThemeableBrowserObject {
|
||||
styleOptions
|
||||
);
|
||||
} catch (e) {
|
||||
window.open(url);
|
||||
if (typeof window !== 'undefined') {
|
||||
window.open(url);
|
||||
}
|
||||
console.warn(
|
||||
'Native: ThemeableBrowser is not installed or you are running on a browser. Falling back to window.open.'
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user