alinea
Version:
Headless git-based CMS
24 lines (21 loc) • 508 B
JavaScript
import "../../chunks/chunk-NZLE2WMY.js";
// src/cli/serve/LiveReload.ts
import { createId } from "alinea/core/Id";
var LiveReload = class {
clients = [];
reload(type) {
const revision = createId();
for (const client of this.clients) {
client.write(`data: ${JSON.stringify({ type, revision })}
`);
if (type === "reload") client.close();
}
if (type === "reload") this.clients.length = 0;
}
register(client) {
this.clients.push(client);
}
};
export {
LiveReload
};