(() => { if (!['localhost', '127.0.0.1'].includes(location.hostname)) return; const events = new EventSource('http://127.0.0.1:8588/events'); let revision; const refresh = (event) => { const next = JSON.parse(event.data).revision; if (revision && revision !== next) location.reload(); revision = next; }; events.addEventListener('ready', refresh); events.addEventListener('update', refresh); })();