@jsenv/core 29.9.0 → 29.9.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 +1 -1
- package/dist/html/explorer.html +4 -3
- package/dist/js/autoreload.js +58 -38
- package/dist/js/server_events_client.js +9 -4
- package/dist/js/supervisor.js +4 -2
- package/dist/main.js +1 -1
- package/package.json +1 -1
- package/src/plugins/autoreload/client/autoreload.js +57 -31
- package/src/plugins/autoreload/client/url_helpers.js +7 -4
- package/src/plugins/explorer/client/explorer.html +4 -3
- package/src/plugins/ribbon/jsenv_plugin_ribbon.js +1 -1
- package/src/plugins/server_events/client/connection_manager.js +8 -3
- package/src/plugins/supervisor/client/supervisor.js +4 -2
- package/src/plugins/autoreload/client/autoreload_preference.js +0 -11
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ https://github.com/jsenv/jsenv-core/wiki
|
|
|
17
17
|
npm install --save-dev @jsenv/core
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
_@jsenv/core_ is tested on Mac, Windows, Linux with Node.js 18.
|
|
20
|
+
_@jsenv/core_ is tested on Mac, Windows, Linux with Node.js 18.
|
|
21
21
|
Other operating systems and Node.js versions are not tested.
|
|
22
22
|
|
|
23
23
|
# Name
|
package/dist/html/explorer.html
CHANGED
|
@@ -133,6 +133,7 @@ h4 {
|
|
|
133
133
|
padding-top: 25px;
|
|
134
134
|
padding-left: 25px;
|
|
135
135
|
padding-right: 25px;
|
|
136
|
+
position: relative;
|
|
136
137
|
}
|
|
137
138
|
|
|
138
139
|
#explorables_header_bottom_spacing {
|
|
@@ -177,7 +178,7 @@ h4 {
|
|
|
177
178
|
fill: #24b1b0;
|
|
178
179
|
}
|
|
179
180
|
|
|
180
|
-
#
|
|
181
|
+
#explorables_icon {
|
|
181
182
|
width: 25px;
|
|
182
183
|
height: 25px;
|
|
183
184
|
stroke: none;
|
|
@@ -285,8 +286,8 @@ h4 {
|
|
|
285
286
|
<section id="explorables">
|
|
286
287
|
<div id="explorables-header">
|
|
287
288
|
<div id="explorables_header_and_menu">
|
|
288
|
-
<h2
|
|
289
|
-
<svg id="
|
|
289
|
+
<h2>
|
|
290
|
+
<svg id="explorables_icon" viewBox="0 0 24 24" width="32" height="32">
|
|
290
291
|
<path d="M0 0h24v24H0V0z" fill="none"></path>
|
|
291
292
|
<path d="M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11z"></path>
|
|
292
293
|
</svg>
|
package/dist/js/autoreload.js
CHANGED
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
import { urlHotMetas } from "./import_meta_hot.js";
|
|
2
2
|
import { parseSrcSet, stringifySrcSet } from "@jsenv/ast/src/html/html_src_set.js";
|
|
3
3
|
|
|
4
|
-
const isAutoreloadEnabled = () => {
|
|
5
|
-
const value = window.localStorage.getItem("autoreload");
|
|
6
|
-
if (value === "0") {
|
|
7
|
-
return false;
|
|
8
|
-
}
|
|
9
|
-
return true;
|
|
10
|
-
};
|
|
11
|
-
const setAutoreloadPreference = value => {
|
|
12
|
-
window.localStorage.setItem("autoreload", value ? "1" : "0");
|
|
13
|
-
};
|
|
14
|
-
|
|
15
4
|
const compareTwoUrlPaths = (url, otherUrl) => {
|
|
16
5
|
if (url === otherUrl) {
|
|
17
6
|
return true;
|
|
18
7
|
}
|
|
19
8
|
const urlObject = new URL(url);
|
|
20
9
|
const otherUrlObject = new URL(otherUrl);
|
|
21
|
-
|
|
10
|
+
if (urlObject.origin !== otherUrlObject.origin) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
if (urlObject.pathname !== otherUrlObject.pathname) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
return true;
|
|
22
17
|
};
|
|
23
18
|
const injectQuery = (url, query) => {
|
|
24
19
|
const urlObject = new URL(url);
|
|
@@ -157,44 +152,68 @@ const reloadJsImport = async url => {
|
|
|
157
152
|
|
|
158
153
|
const reloader = {
|
|
159
154
|
urlHotMetas,
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
reloader.onstatuschange();
|
|
155
|
+
status: {
|
|
156
|
+
value: "idle",
|
|
157
|
+
onchange: () => {},
|
|
158
|
+
goTo: value => {
|
|
159
|
+
reloader.status.value = value;
|
|
160
|
+
reloader.status.onchange();
|
|
161
|
+
}
|
|
168
162
|
},
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
reloader.
|
|
174
|
-
|
|
175
|
-
reloader.
|
|
163
|
+
autoreload: {
|
|
164
|
+
enabled: ["1", null].includes(window.localStorage.getItem("autoreload")),
|
|
165
|
+
onchange: () => {},
|
|
166
|
+
enable: () => {
|
|
167
|
+
reloader.autoreload.enabled = true;
|
|
168
|
+
window.localStorage.setItem("autoreload", "1");
|
|
169
|
+
reloader.autoreload.onchange();
|
|
170
|
+
},
|
|
171
|
+
disable: () => {
|
|
172
|
+
reloader.autoreload.enabled = false;
|
|
173
|
+
window.localStorage.setItem("autoreload", "0");
|
|
174
|
+
reloader.autoreload.onchange();
|
|
176
175
|
}
|
|
177
176
|
},
|
|
177
|
+
changes: {
|
|
178
|
+
value: [],
|
|
179
|
+
onchange: () => {},
|
|
180
|
+
add: reloadMessage => {
|
|
181
|
+
reloader.changes.value.push(reloadMessage);
|
|
182
|
+
reloader.changes.onchange();
|
|
183
|
+
if (reloader.autoreload.enabled) {
|
|
184
|
+
reloader.reload();
|
|
185
|
+
} else {
|
|
186
|
+
reloader.status.goTo("can_reload");
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
remove: reloadMessage => {
|
|
190
|
+
const index = reloader.changes.value.indexOf(reloadMessage);
|
|
191
|
+
if (index > -1) {
|
|
192
|
+
reloader.changes.value.splice(index, 1);
|
|
193
|
+
if (reloader.changes.value.length === 0) {
|
|
194
|
+
reloader.status.goTo("idle");
|
|
195
|
+
}
|
|
196
|
+
reloader.changes.onchange();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
currentExecution: null,
|
|
178
201
|
reload: () => {
|
|
179
|
-
const someEffectIsFullReload = reloader.
|
|
202
|
+
const someEffectIsFullReload = reloader.changes.value.some(reloadMessage => reloadMessage.type === "full");
|
|
180
203
|
if (someEffectIsFullReload) {
|
|
181
204
|
reloadHtmlPage();
|
|
182
205
|
return;
|
|
183
206
|
}
|
|
184
|
-
reloader.
|
|
207
|
+
reloader.status.goTo("reloading");
|
|
185
208
|
const onApplied = reloadMessage => {
|
|
186
|
-
|
|
187
|
-
reloader.messages.splice(index, 1);
|
|
188
|
-
if (reloader.messages.length === 0) {
|
|
189
|
-
reloader.setStatus("idle");
|
|
190
|
-
}
|
|
209
|
+
reloader.changes.remove(reloadMessage);
|
|
191
210
|
};
|
|
192
211
|
const setReloadMessagePromise = (reloadMessage, promise) => {
|
|
193
212
|
promise.then(() => {
|
|
194
213
|
onApplied(reloadMessage);
|
|
195
214
|
reloader.currentExecution = null;
|
|
196
215
|
}, e => {
|
|
197
|
-
reloader.
|
|
216
|
+
reloader.status.goTo("failed");
|
|
198
217
|
if (typeof window.reportError === "function") {
|
|
199
218
|
window.reportError(e);
|
|
200
219
|
} else {
|
|
@@ -205,7 +224,7 @@ This could be due to syntax errors or importing non-existent modules (see errors
|
|
|
205
224
|
reloader.currentExecution = null;
|
|
206
225
|
});
|
|
207
226
|
};
|
|
208
|
-
reloader.
|
|
227
|
+
reloader.changes.value.forEach(reloadMessage => {
|
|
209
228
|
if (reloadMessage.type === "hot") {
|
|
210
229
|
const promise = addToHotQueue(() => {
|
|
211
230
|
return applyHotReload(reloadMessage);
|
|
@@ -297,7 +316,8 @@ const applyHotReload = async ({
|
|
|
297
316
|
return namespace;
|
|
298
317
|
}
|
|
299
318
|
if (type === "html") {
|
|
300
|
-
|
|
319
|
+
const isRootHtmlFile = window.location.pathname === "/" && new URL(urlToFetch).pathname.slice(1).indexOf("/") === -1;
|
|
320
|
+
if (!isRootHtmlFile && !compareTwoUrlPaths(urlToFetch, window.location.href)) {
|
|
301
321
|
// we are not in that HTML page
|
|
302
322
|
return null;
|
|
303
323
|
}
|
|
@@ -325,6 +345,6 @@ const applyHotReload = async ({
|
|
|
325
345
|
window.__reloader__ = reloader;
|
|
326
346
|
window.__server_events__.listenEvents({
|
|
327
347
|
reload: reloadServerEvent => {
|
|
328
|
-
reloader.
|
|
348
|
+
reloader.changes.add(reloadServerEvent.data);
|
|
329
349
|
}
|
|
330
350
|
});
|
|
@@ -30,7 +30,8 @@ const createConnectionManager = (attemptConnection, {
|
|
|
30
30
|
let msSpent = 0;
|
|
31
31
|
const attempt = () => {
|
|
32
32
|
readyState.goTo(READY_STATES.CONNECTING);
|
|
33
|
-
|
|
33
|
+
let timeout;
|
|
34
|
+
const cancelAttempt = attemptConnection({
|
|
34
35
|
onClosed: () => {
|
|
35
36
|
if (!retry) {
|
|
36
37
|
readyState.goTo(READY_STATES.CLOSED);
|
|
@@ -47,7 +48,6 @@ const createConnectionManager = (attemptConnection, {
|
|
|
47
48
|
console.info(`[jsenv] could not connect to server in less than ${retryAllocatedMs}ms`);
|
|
48
49
|
return;
|
|
49
50
|
}
|
|
50
|
-
|
|
51
51
|
// if closed while open -> connection lost
|
|
52
52
|
// otherwise it's the attempt to connect for the first time
|
|
53
53
|
// or to reconnect
|
|
@@ -55,7 +55,7 @@ const createConnectionManager = (attemptConnection, {
|
|
|
55
55
|
console.info(`[jsenv] server connection lost; retrying to connect`);
|
|
56
56
|
}
|
|
57
57
|
retryCount++;
|
|
58
|
-
setTimeout(() => {
|
|
58
|
+
timeout = setTimeout(() => {
|
|
59
59
|
msSpent += retryAfter;
|
|
60
60
|
attempt();
|
|
61
61
|
}, retryAfter);
|
|
@@ -65,8 +65,13 @@ const createConnectionManager = (attemptConnection, {
|
|
|
65
65
|
// console.info(`[jsenv] connected to server`)
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
|
-
};
|
|
69
68
|
|
|
69
|
+
_disconnect = () => {
|
|
70
|
+
cancelAttempt();
|
|
71
|
+
clearTimeout(timeout);
|
|
72
|
+
readyState.goTo(READY_STATES.CLOSED);
|
|
73
|
+
};
|
|
74
|
+
};
|
|
70
75
|
attempt();
|
|
71
76
|
};
|
|
72
77
|
const disconnect = () => {
|
package/dist/js/supervisor.js
CHANGED
|
@@ -650,8 +650,10 @@ window.__supervisor__ = (() => {
|
|
|
650
650
|
errorDetailsPromise
|
|
651
651
|
});
|
|
652
652
|
if (window.__reloader__) {
|
|
653
|
-
window.__reloader__.
|
|
654
|
-
|
|
653
|
+
const onchange = window.__reloader__.status.onchange;
|
|
654
|
+
window.__reloader__.status.onchange = () => {
|
|
655
|
+
onchange();
|
|
656
|
+
if (window.__reloader__.status.value === "reloading") {
|
|
655
657
|
removeErrorOverlay();
|
|
656
658
|
}
|
|
657
659
|
};
|
package/dist/main.js
CHANGED
|
@@ -20701,7 +20701,7 @@ const jsenvPluginRibbon = ({
|
|
|
20701
20701
|
appliesDuring: "dev",
|
|
20702
20702
|
transformUrlContent: {
|
|
20703
20703
|
html: (urlInfo, context) => {
|
|
20704
|
-
if (urlInfo.data.noribbon) {
|
|
20704
|
+
if (urlInfo.data.isJsenvToolbar || urlInfo.data.noribbon) {
|
|
20705
20705
|
return null;
|
|
20706
20706
|
}
|
|
20707
20707
|
const {
|
package/package.json
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import { urlHotMetas } from "../../import_meta_hot/client/import_meta_hot.js"
|
|
2
|
-
import {
|
|
3
|
-
isAutoreloadEnabled,
|
|
4
|
-
setAutoreloadPreference,
|
|
5
|
-
} from "./autoreload_preference.js"
|
|
6
2
|
import { compareTwoUrlPaths } from "./url_helpers.js"
|
|
7
3
|
import {
|
|
8
4
|
reloadHtmlPage,
|
|
@@ -12,39 +8,63 @@ import {
|
|
|
12
8
|
|
|
13
9
|
const reloader = {
|
|
14
10
|
urlHotMetas,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
reloader.onstatuschange()
|
|
11
|
+
status: {
|
|
12
|
+
value: "idle",
|
|
13
|
+
onchange: () => {},
|
|
14
|
+
goTo: (value) => {
|
|
15
|
+
reloader.status.value = value
|
|
16
|
+
reloader.status.onchange()
|
|
17
|
+
},
|
|
23
18
|
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
reloader.
|
|
29
|
-
|
|
30
|
-
reloader.
|
|
31
|
-
}
|
|
19
|
+
autoreload: {
|
|
20
|
+
enabled: ["1", null].includes(window.localStorage.getItem("autoreload")),
|
|
21
|
+
onchange: () => {},
|
|
22
|
+
enable: () => {
|
|
23
|
+
reloader.autoreload.enabled = true
|
|
24
|
+
window.localStorage.setItem("autoreload", "1")
|
|
25
|
+
reloader.autoreload.onchange()
|
|
26
|
+
},
|
|
27
|
+
disable: () => {
|
|
28
|
+
reloader.autoreload.enabled = false
|
|
29
|
+
window.localStorage.setItem("autoreload", "0")
|
|
30
|
+
reloader.autoreload.onchange()
|
|
31
|
+
},
|
|
32
32
|
},
|
|
33
|
+
changes: {
|
|
34
|
+
value: [],
|
|
35
|
+
onchange: () => {},
|
|
36
|
+
add: (reloadMessage) => {
|
|
37
|
+
reloader.changes.value.push(reloadMessage)
|
|
38
|
+
reloader.changes.onchange()
|
|
39
|
+
if (reloader.autoreload.enabled) {
|
|
40
|
+
reloader.reload()
|
|
41
|
+
} else {
|
|
42
|
+
reloader.status.goTo("can_reload")
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
remove: (reloadMessage) => {
|
|
46
|
+
const index = reloader.changes.value.indexOf(reloadMessage)
|
|
47
|
+
if (index > -1) {
|
|
48
|
+
reloader.changes.value.splice(index, 1)
|
|
49
|
+
if (reloader.changes.value.length === 0) {
|
|
50
|
+
reloader.status.goTo("idle")
|
|
51
|
+
}
|
|
52
|
+
reloader.changes.onchange()
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
currentExecution: null,
|
|
33
57
|
reload: () => {
|
|
34
|
-
const someEffectIsFullReload = reloader.
|
|
58
|
+
const someEffectIsFullReload = reloader.changes.value.some(
|
|
35
59
|
(reloadMessage) => reloadMessage.type === "full",
|
|
36
60
|
)
|
|
37
61
|
if (someEffectIsFullReload) {
|
|
38
62
|
reloadHtmlPage()
|
|
39
63
|
return
|
|
40
64
|
}
|
|
41
|
-
reloader.
|
|
65
|
+
reloader.status.goTo("reloading")
|
|
42
66
|
const onApplied = (reloadMessage) => {
|
|
43
|
-
|
|
44
|
-
reloader.messages.splice(index, 1)
|
|
45
|
-
if (reloader.messages.length === 0) {
|
|
46
|
-
reloader.setStatus("idle")
|
|
47
|
-
}
|
|
67
|
+
reloader.changes.remove(reloadMessage)
|
|
48
68
|
}
|
|
49
69
|
const setReloadMessagePromise = (reloadMessage, promise) => {
|
|
50
70
|
promise.then(
|
|
@@ -53,7 +73,7 @@ const reloader = {
|
|
|
53
73
|
reloader.currentExecution = null
|
|
54
74
|
},
|
|
55
75
|
(e) => {
|
|
56
|
-
reloader.
|
|
76
|
+
reloader.status.goTo("failed")
|
|
57
77
|
if (typeof window.reportError === "function") {
|
|
58
78
|
window.reportError(e)
|
|
59
79
|
} else {
|
|
@@ -67,7 +87,7 @@ This could be due to syntax errors or importing non-existent modules (see errors
|
|
|
67
87
|
},
|
|
68
88
|
)
|
|
69
89
|
}
|
|
70
|
-
reloader.
|
|
90
|
+
reloader.changes.value.forEach((reloadMessage) => {
|
|
71
91
|
if (reloadMessage.type === "hot") {
|
|
72
92
|
const promise = addToHotQueue(() => {
|
|
73
93
|
return applyHotReload(reloadMessage)
|
|
@@ -162,7 +182,13 @@ const applyHotReload = async ({ hotInstructions }) => {
|
|
|
162
182
|
return namespace
|
|
163
183
|
}
|
|
164
184
|
if (type === "html") {
|
|
165
|
-
|
|
185
|
+
const isRootHtmlFile =
|
|
186
|
+
window.location.pathname === "/" &&
|
|
187
|
+
new URL(urlToFetch).pathname.slice(1).indexOf("/") === -1
|
|
188
|
+
if (
|
|
189
|
+
!isRootHtmlFile &&
|
|
190
|
+
!compareTwoUrlPaths(urlToFetch, window.location.href)
|
|
191
|
+
) {
|
|
166
192
|
// we are not in that HTML page
|
|
167
193
|
return null
|
|
168
194
|
}
|
|
@@ -194,6 +220,6 @@ const applyHotReload = async ({ hotInstructions }) => {
|
|
|
194
220
|
window.__reloader__ = reloader
|
|
195
221
|
window.__server_events__.listenEvents({
|
|
196
222
|
reload: (reloadServerEvent) => {
|
|
197
|
-
reloader.
|
|
223
|
+
reloader.changes.add(reloadServerEvent.data)
|
|
198
224
|
},
|
|
199
225
|
})
|
|
@@ -4,10 +4,13 @@ export const compareTwoUrlPaths = (url, otherUrl) => {
|
|
|
4
4
|
}
|
|
5
5
|
const urlObject = new URL(url)
|
|
6
6
|
const otherUrlObject = new URL(otherUrl)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
)
|
|
7
|
+
if (urlObject.origin !== otherUrlObject.origin) {
|
|
8
|
+
return false
|
|
9
|
+
}
|
|
10
|
+
if (urlObject.pathname !== otherUrlObject.pathname) {
|
|
11
|
+
return false
|
|
12
|
+
}
|
|
13
|
+
return true
|
|
11
14
|
}
|
|
12
15
|
|
|
13
16
|
export const injectQuery = (url, query) => {
|
|
@@ -175,6 +175,7 @@
|
|
|
175
175
|
padding-right: 25px;
|
|
176
176
|
padding-top: 25px;
|
|
177
177
|
background-color: #204143;
|
|
178
|
+
position: relative;
|
|
178
179
|
}
|
|
179
180
|
|
|
180
181
|
#explorables_header_bottom_spacing {
|
|
@@ -220,7 +221,7 @@
|
|
|
220
221
|
fill: #24b1b0;
|
|
221
222
|
}
|
|
222
223
|
|
|
223
|
-
#
|
|
224
|
+
#explorables_icon {
|
|
224
225
|
width: 25px;
|
|
225
226
|
height: 25px;
|
|
226
227
|
stroke: none;
|
|
@@ -325,9 +326,9 @@
|
|
|
325
326
|
<section id="explorables">
|
|
326
327
|
<div id="explorables-header">
|
|
327
328
|
<div id="explorables_header_and_menu">
|
|
328
|
-
<h2
|
|
329
|
+
<h2>
|
|
329
330
|
<svg
|
|
330
|
-
id="
|
|
331
|
+
id="explorables_icon"
|
|
331
332
|
viewBox="0 0 24 24"
|
|
332
333
|
width="32"
|
|
333
334
|
height="32"
|
|
@@ -25,7 +25,7 @@ export const jsenvPluginRibbon = ({
|
|
|
25
25
|
appliesDuring: "dev",
|
|
26
26
|
transformUrlContent: {
|
|
27
27
|
html: (urlInfo, context) => {
|
|
28
|
-
if (urlInfo.data.noribbon) {
|
|
28
|
+
if (urlInfo.data.isJsenvToolbar || urlInfo.data.noribbon) {
|
|
29
29
|
return null
|
|
30
30
|
}
|
|
31
31
|
const { ribbon } = URL_META.applyAssociations({
|
|
@@ -34,7 +34,8 @@ export const createConnectionManager = (
|
|
|
34
34
|
let msSpent = 0
|
|
35
35
|
const attempt = () => {
|
|
36
36
|
readyState.goTo(READY_STATES.CONNECTING)
|
|
37
|
-
|
|
37
|
+
let timeout
|
|
38
|
+
const cancelAttempt = attemptConnection({
|
|
38
39
|
onClosed: () => {
|
|
39
40
|
if (!retry) {
|
|
40
41
|
readyState.goTo(READY_STATES.CLOSED)
|
|
@@ -55,7 +56,6 @@ export const createConnectionManager = (
|
|
|
55
56
|
)
|
|
56
57
|
return
|
|
57
58
|
}
|
|
58
|
-
|
|
59
59
|
// if closed while open -> connection lost
|
|
60
60
|
// otherwise it's the attempt to connect for the first time
|
|
61
61
|
// or to reconnect
|
|
@@ -63,7 +63,7 @@ export const createConnectionManager = (
|
|
|
63
63
|
console.info(`[jsenv] server connection lost; retrying to connect`)
|
|
64
64
|
}
|
|
65
65
|
retryCount++
|
|
66
|
-
setTimeout(() => {
|
|
66
|
+
timeout = setTimeout(() => {
|
|
67
67
|
msSpent += retryAfter
|
|
68
68
|
attempt()
|
|
69
69
|
}, retryAfter)
|
|
@@ -73,6 +73,11 @@ export const createConnectionManager = (
|
|
|
73
73
|
// console.info(`[jsenv] connected to server`)
|
|
74
74
|
},
|
|
75
75
|
})
|
|
76
|
+
_disconnect = () => {
|
|
77
|
+
cancelAttempt()
|
|
78
|
+
clearTimeout(timeout)
|
|
79
|
+
readyState.goTo(READY_STATES.CLOSED)
|
|
80
|
+
}
|
|
76
81
|
}
|
|
77
82
|
attempt()
|
|
78
83
|
}
|
|
@@ -664,8 +664,10 @@ window.__supervisor__ = (() => {
|
|
|
664
664
|
errorDetailsPromise,
|
|
665
665
|
})
|
|
666
666
|
if (window.__reloader__) {
|
|
667
|
-
window.__reloader__.
|
|
668
|
-
|
|
667
|
+
const onchange = window.__reloader__.status.onchange
|
|
668
|
+
window.__reloader__.status.onchange = () => {
|
|
669
|
+
onchange()
|
|
670
|
+
if (window.__reloader__.status.value === "reloading") {
|
|
669
671
|
removeErrorOverlay()
|
|
670
672
|
}
|
|
671
673
|
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export const isAutoreloadEnabled = () => {
|
|
2
|
-
const value = window.localStorage.getItem("autoreload")
|
|
3
|
-
if (value === "0") {
|
|
4
|
-
return false
|
|
5
|
-
}
|
|
6
|
-
return true
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const setAutoreloadPreference = (value) => {
|
|
10
|
-
window.localStorage.setItem("autoreload", value ? "1" : "0")
|
|
11
|
-
}
|