diff --git a/network/src/web.ts b/network/src/web.ts index eb84ceac9..6e0fe9285 100644 --- a/network/src/web.ts +++ b/network/src/web.ts @@ -59,8 +59,10 @@ function translatedConnection(): ConnectionType { export class NetworkWeb extends WebPlugin implements NetworkPlugin { constructor() { super(); - window.addEventListener('online', this.handleOnline); - window.addEventListener('offline', this.handleOffline); + if (typeof window !== 'undefined') { + window.addEventListener('online', this.handleOnline); + window.addEventListener('offline', this.handleOffline); + } } async getStatus(): Promise {