mirror of
https://github.com/morten-olsen/morten-olsen.github.io.git
synced 2026-02-08 01:46:28 +01:00
10 lines
250 B
TypeScript
10 lines
250 B
TypeScript
import EventSource from 'eventsource';
|
|
|
|
const path = encodeURIComponent(window.location.pathname);
|
|
const source = new EventSource(`/dev?path=${path}`);
|
|
source.onmessage = (msg) => {
|
|
if (msg.data === 'reload') {
|
|
window.location.reload();
|
|
}
|
|
};
|