Skip to content

Commit

Permalink
Check window in BrowserConnectivityMonitor (#1810)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Chen authored May 23, 2019
1 parent 772115a commit 42eae23
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/firestore/src/platform_browser/browser_platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { Connection } from '../remote/connection';
import { JsonProtoSerializer } from '../remote/serializer';
import { ConnectivityMonitor } from './../remote/connectivity_monitor';

import { NoopConnectivityMonitor } from '../remote/connectivity_monitor_noop';
import { BrowserConnectivityMonitor } from './browser_connectivity_monitor';
import { WebChannelConnection } from './webchannel_connection';

Expand All @@ -46,7 +47,11 @@ export class BrowserPlatform implements Platform {
}

newConnectivityMonitor(): ConnectivityMonitor {
return new BrowserConnectivityMonitor();
if (this.window !== undefined) {
return new BrowserConnectivityMonitor();
} else {
return new NoopConnectivityMonitor();
}
}

newSerializer(databaseId: DatabaseId): JsonProtoSerializer {
Expand Down

0 comments on commit 42eae23

Please sign in to comment.