diff --git a/packages/extensions/ws/src/index.ts b/packages/extensions/ws/src/index.ts index 8ef2d0f4..d018ac76 100644 --- a/packages/extensions/ws/src/index.ts +++ b/packages/extensions/ws/src/index.ts @@ -200,14 +200,17 @@ class WebSocketExtension extends SdkExtension { ); // browser only code start - if (typeof window !== "undefined" && window.addEventListener) { - window.addEventListener("offline", () => { + if ( + typeof globalThis.window !== "undefined" && + globalThis.window.addEventListener + ) { + globalThis.window.addEventListener("offline", () => { if (this.pingServerHandle) { clearTimeout(this.pingServerHandle); } this.ws?.close(); }); - window.addEventListener("online", () => { + globalThis.window.addEventListener("online", () => { check(); }); } diff --git a/tsconfig.json b/tsconfig.json index 6102b41c..6c2108f8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,6 @@ { "compilerOptions": { "esModuleInterop": true, - "lib": ["DOM"], "declaration": true, "sourceMap": true }