diff --git a/README.md b/README.md index 9adc157..d5fca89 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,8 @@ bun run your-app-entrypoint.js ## changelog +- **Version 1.2.1** + - bugfix: check for `window` without causing error - **Version 1.2.0** - modified `frontend/index.js` such that script can now be used in SharedWorker and HTTPS contexts - **Version 1.1.0** diff --git a/frontend/index.js b/frontend/index.js index e52ebbc..f4eae2c 100644 --- a/frontend/index.js +++ b/frontend/index.js @@ -34,7 +34,7 @@ class FramerockUtils { console.debug('SETUP TRANSPORT') - const ctx_location = window ? window.location : self.location + const ctx_location = (typeof window !== "undefined") ? window.location : self.location const ws_protocol = ctx_location.protocol === 'http:' ? 'ws:' : 'wss:' this._ws = new WebSocket(`${ws_protocol}//${ctx_location.host}/ws`) diff --git a/package.json b/package.json index 0fce878..92f3088 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "framerock", - "version": "1.2.0", + "version": "1.2.1", "type": "module", "main": "backend/index.js" }