Skip to content

Commit bae5f1e

Browse files
Support BrowserPlatforms with no window or document
1 parent a56134b commit bae5f1e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

packages/firestore/src/platform_browser/browser_platform.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,18 @@ export class BrowserPlatform implements Platform {
2727

2828
readonly emptyByteString = '';
2929

30-
readonly document = document;
31-
32-
readonly window = window;
33-
3430
constructor() {
3531
this.base64Available = typeof atob !== 'undefined';
3632
}
3733

34+
get document(): Document | null {
35+
return typeof document !== 'undefined' ? document : null;
36+
}
37+
38+
get window(): Window | null {
39+
return typeof window !== 'undefined' ? window : null;
40+
}
41+
3842
loadConnection(databaseInfo: DatabaseInfo): Promise<Connection> {
3943
return Promise.resolve(new WebChannelConnection(databaseInfo));
4044
}

0 commit comments

Comments
 (0)