@mariozechner/create-app
Version:
CLI for creating deployable web applications with Docker, Caddy, and modern tooling
15 lines (14 loc) • 430 B
text/typescript
// Live reload for development
if (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1') {
const ws = new WebSocket(`ws://${window.location.host}/livereload`);
ws.onmessage = () => {
// Force hard refresh to clear any cached state
location.reload(true);
};
// Reconnect on disconnect
ws.onclose = () => {
setTimeout(() => {
location.reload(true);
}, 1000);
};
}