dmx-api 3.0.0 → 3.0.1
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/README.md +8 -2
- package/package.json +1 -1
- package/src/index.js +1 -2
- package/src/websocket.js +11 -9
package/README.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
## Version History
|
|
4
4
|
|
|
5
|
+
**3.0.1** -- Jun 6, 2023
|
|
6
|
+
|
|
7
|
+
* Improvement:
|
|
8
|
+
- In case of a dropped WebSocket connection an alert is shown and the page is reloaded
|
|
9
|
+
|
|
5
10
|
**3.0** -- May 19, 2023
|
|
6
11
|
|
|
7
12
|
Version 3.0 of the `dmx-api` library extends/modifies the API in order to support a wider variety of frontend
|
|
@@ -30,6 +35,7 @@ library's `init()` function.
|
|
|
30
35
|
- change `Type`'s `newFormModel()`:
|
|
31
36
|
- `object` parameter is now optional
|
|
32
37
|
- add `allChildren` parameter (optional)
|
|
38
|
+
- add (optional) `level` parameter to `CompDef`'s `emptyChildInstance()`
|
|
33
39
|
- add `panX`, `panY`, `zoom`, `bgImageUrl` getters to `Topicmap`
|
|
34
40
|
- add `updateTopic()`, `updateAssoc()` to `Topicmap` (part of
|
|
35
41
|
[dmx-topicmap-panel](https://github.com/dmx-systems/dmx-topicmap-panel) protocol)
|
|
@@ -46,7 +52,7 @@ library's `init()` function.
|
|
|
46
52
|
* Utils:
|
|
47
53
|
- add `stripHtml()`
|
|
48
54
|
* Fix:
|
|
49
|
-
- fixed a bug where nested entities loose their child values while update request
|
|
55
|
+
- fixed a bug where nested entities loose their child values while update request (thanks to @gevlish)
|
|
50
56
|
|
|
51
57
|
**2.1** -- Jun 13, 2021
|
|
52
58
|
|
|
@@ -316,4 +322,4 @@ library's `init()` function.
|
|
|
316
322
|
|
|
317
323
|
------------
|
|
318
324
|
Jörg Richter
|
|
319
|
-
Jun
|
|
325
|
+
Jun 6, 2023
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import icons from './icons'
|
|
|
6
6
|
import DMXWebSocket from './websocket'
|
|
7
7
|
import {default as typeCache, init as initTypeCache, storeModule} from './type-cache'
|
|
8
8
|
|
|
9
|
-
console.log('[DMX-API] 3.0')
|
|
9
|
+
console.log('[DMX-API] 3.0.1')
|
|
10
10
|
|
|
11
11
|
let adminWorkspaceId // promise
|
|
12
12
|
|
|
@@ -42,7 +42,6 @@ export default {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
function updateClientIdCookie () {
|
|
45
|
-
// DEV && console.log('dmx_client_id', clientId)
|
|
46
45
|
utils.setCookie('dmx_client_id', clientId)
|
|
47
46
|
}
|
|
48
47
|
|
package/src/websocket.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
const IDLE_INTERVAL
|
|
2
|
-
const RECONNECT_DELAY = 5 * 1000 // 5s
|
|
1
|
+
const IDLE_INTERVAL = 60 * 1000 // 60s
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* A WebSocket connection to the DMX server.
|
|
@@ -48,20 +47,15 @@ export default class DMXWebSocket {
|
|
|
48
47
|
this.messageHandler(message)
|
|
49
48
|
}
|
|
50
49
|
this.ws.onclose = e => {
|
|
51
|
-
DEV && console.log('[DMX]
|
|
52
|
-
RECONNECT_DELAY / 1000 + ' seconds')
|
|
50
|
+
DEV && console.log('[DMX] WebSocket connection closed (' + e.reason + ')')
|
|
53
51
|
this._stopIdling()
|
|
54
|
-
this.
|
|
52
|
+
this._reload() // a closed ws connection is regarded an (backend/network) error which requires page reloading
|
|
55
53
|
}
|
|
56
54
|
this.ws.onerror = e => {
|
|
57
55
|
DEV && console.warn('[DMX] WebSocket error')
|
|
58
56
|
}
|
|
59
57
|
}
|
|
60
58
|
|
|
61
|
-
_reconnect () {
|
|
62
|
-
setTimeout(this._connect.bind(this), RECONNECT_DELAY)
|
|
63
|
-
}
|
|
64
|
-
|
|
65
59
|
_startIdling () {
|
|
66
60
|
this.idleId = setInterval(this._idle.bind(this), IDLE_INTERVAL)
|
|
67
61
|
}
|
|
@@ -74,4 +68,12 @@ export default class DMXWebSocket {
|
|
|
74
68
|
DEV && console.log('[DMX] WebSocket connection idle')
|
|
75
69
|
this.send({type: 'idle'})
|
|
76
70
|
}
|
|
71
|
+
|
|
72
|
+
_reload () {
|
|
73
|
+
setTimeout(() => {
|
|
74
|
+
alert('There is a problem with the server or network.\n\nPlease press OK to reload page.\n' +
|
|
75
|
+
'If it fails try manual page reload.')
|
|
76
|
+
location.reload()
|
|
77
|
+
}, 1000) // timeout to not interfere with interactive page reload (which also closes websocket connection)
|
|
78
|
+
}
|
|
77
79
|
}
|