Skip to content

Commit 4d24e4c

Browse files
jorgecotillobrockallen
authored andcommitted
Merge: Adding validation to check if window object exists before using it. DuendeArchive#411
1 parent f564f97 commit 4d24e4c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎src/Global.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ export class Global {
2626
}
2727

2828
static get localStorage() {
29-
if (!testing) {
29+
if (!testing && typeof window !== 'undefined') {
3030
return localStorage;
3131
}
3232
}
3333

3434
static get sessionStorage() {
35-
if (!testing) {
35+
if (!testing && typeof window !== 'undefined') {
3636
return sessionStorage;
3737
}
3838
}
@@ -42,7 +42,7 @@ export class Global {
4242
}
4343

4444
static get XMLHttpRequest() {
45-
if (!testing) {
45+
if (!testing && typeof window !== 'undefined') {
4646
return request || XMLHttpRequest;
4747
}
4848
}

0 commit comments

Comments
 (0)