Skip to content

Commit f589209

Browse files
authored
Merge pull request #65 from nik0kin/feature/check-for-window
check for existence of window before using it
2 parents 69fdf63 + 8e4b5eb commit f589209

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/apiClient.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3872,7 +3872,7 @@ function getRemoteImagePrefix(instance, options) {
38723872
}
38733873

38743874
function normalizeImageOptions(instance, options) {
3875-
let ratio = window.devicePixelRatio || 1;
3875+
let ratio = window && window.devicePixelRatio || 1;
38763876

38773877
if (ratio) {
38783878
if (options.minScale) {

src/appStorage.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function onCacheOpened(result) {
1717
class AppStore {
1818
constructor() {
1919
try {
20-
if (self.caches) {
20+
if (self && self.caches) {
2121
caches.open('embydata').then(onCacheOpened.bind(this));
2222
}
2323
} catch (err) {

src/connectionManager.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ export default class ConnectionManager {
524524
resolve(servers);
525525
};
526526

527-
if (window.NativeShell && typeof window.NativeShell.findServers === 'function') {
527+
if (window && window.NativeShell && typeof window.NativeShell.findServers === 'function') {
528528
window.NativeShell.findServers(1e3).then(onFinish, function () {
529529
onFinish([]);
530530
});

0 commit comments

Comments
 (0)