Skip to content
This repository was archived by the owner on Jan 19, 2023. It is now read-only.

Commit 31c71b8

Browse files
committed
Merge branch 'Ionut-Milas-master'
2 parents 29519b4 + f153aa7 commit 31c71b8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/util.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,23 @@ export function translate(str, replaceStrings = null) {
2828

2929

3030
export function getWindowWidth() {
31-
return window.innerWidth ||
31+
if (typeof window === 'undefined') {
32+
return 0;
33+
} else {
34+
return window.innerWidth ||
3235
document.documentElement.clientWidth ||
3336
document.body.clientWidth;
37+
}
3438
}
3539

3640
export function getWindowHeight() {
41+
if (typeof window === 'undefined') {
42+
return 0;
43+
} else {
3744
return window.innerHeight ||
3845
document.documentElement.clientHeight ||
3946
document.body.clientHeight;
47+
}
4048
}
4149

4250
// Returns true if this window is rendered as an iframe inside another window

0 commit comments

Comments
 (0)