import { HMR_CLIENT } from "https://deno.land/x/ter@0.14.2/constants.ts";
type
`((l) => {
let w, i;
function d(m) { console.info("[refresh] ", m); }
function r() { l.reload(); }
function s(f) {
w && w.close();
w = new WebSocket(\`\${l.origin.replace("http", "ws")}/refresh\`);
w.addEventListener("open", f);
w.addEventListener("message", () => {
d("reloading...");
r();
});
w.addEventListener("close", () => {
d("connection lost - reconnecting...");
clearTimeout(i);
i = setTimeout(() => s(r), 1000);
});
}
s();
})(location)`