@jcbuisson/express-x-client 1.5.5 → 1.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.mjs +3 -3
package/package.json
CHANGED
package/src/index.mjs
CHANGED
|
@@ -19,12 +19,12 @@ export default function expressXClient(socket, options={}) {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
function _getCnxId() {
|
|
22
|
-
if (typeof
|
|
22
|
+
if (typeof sessionStorage !== 'undefined') return sessionStorage.getItem('expressx-cnx-id')
|
|
23
23
|
return nodeCnxId
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
function _setCnxId(id) {
|
|
27
|
-
if (typeof
|
|
27
|
+
if (typeof sessionStorage !== 'undefined') {
|
|
28
28
|
sessionStorage.setItem('expressx-cnx-id', id)
|
|
29
29
|
} else {
|
|
30
30
|
nodeCnxId = id
|
|
@@ -79,7 +79,7 @@ export default function expressXClient(socket, options={}) {
|
|
|
79
79
|
})
|
|
80
80
|
|
|
81
81
|
// disconnection due to a page reload
|
|
82
|
-
if (typeof window !== 'undefined') {
|
|
82
|
+
if (typeof window !== 'undefined' && 'addEventListener' in window) {
|
|
83
83
|
window.addEventListener('unload', () => {
|
|
84
84
|
const id = _getCnxId()
|
|
85
85
|
if (id > 0) {
|