pub const LIVERELOAD_JS: &str = "const es = new EventSource(\"/livereload\");\nlet openedOnce = false;\nes.onopen = function () {\n if (openedOnce) {\n document.dispatchEvent(new CustomEvent(\"cabinRefresh\"));\n const link = document.getElementById(\"cabin-styles\");\n if (link) {\n const url = new URL(link.href, location.href);\n url.searchParams.set(\"liveReload\", Date.now());\n link.href = url.href;\n }\n } else {\n openedOnce = true;\n }\n};\nwindow.addEventListener(\"unload\", function () {\n // Workaround for Chrome sometimes stalling requests due to the open connection\n es.close();\n});\n// TODO: ignore timeout errors?\n// es.onerror = function (err) {};\n";