tova 0.4.5 → 0.4.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/bin/tova.js +9 -3
- package/package.json +1 -1
- package/src/version.js +1 -1
package/bin/tova.js
CHANGED
|
@@ -1319,13 +1319,19 @@ async function generateDevHTML(clientCode, srcDir, reloadPort = 0) {
|
|
|
1319
1319
|
const liveReloadScript = reloadPort ? `
|
|
1320
1320
|
<script>
|
|
1321
1321
|
(function() {
|
|
1322
|
-
var
|
|
1322
|
+
var reloadUrl = "http://localhost:${reloadPort}/__tova_reload";
|
|
1323
|
+
var es = new EventSource(reloadUrl);
|
|
1324
|
+
var errorCount = 0;
|
|
1325
|
+
es.onopen = function() { errorCount = 0; };
|
|
1323
1326
|
es.onmessage = function(e) { if (e.data === "reload") window.location.reload(); };
|
|
1324
1327
|
es.onerror = function() {
|
|
1328
|
+
errorCount++;
|
|
1329
|
+
// EventSource auto-reconnects — only intervene after repeated failures
|
|
1330
|
+
if (errorCount < 3) return;
|
|
1325
1331
|
es.close();
|
|
1326
|
-
//
|
|
1332
|
+
// SSE server is likely gone (dev server restarting) — poll until back
|
|
1327
1333
|
var check = setInterval(function() {
|
|
1328
|
-
fetch(
|
|
1334
|
+
fetch(reloadUrl, { mode: "no-cors" }).then(function(r) {
|
|
1329
1335
|
clearInterval(check);
|
|
1330
1336
|
window.location.reload();
|
|
1331
1337
|
}).catch(function() {});
|
package/package.json
CHANGED
package/src/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Auto-generated by scripts/embed-runtime.js — do not edit
|
|
2
|
-
export const VERSION = "0.4.
|
|
2
|
+
export const VERSION = "0.4.6";
|