Add a banner to indicate updates in progress
This commit is contained in:
@@ -43,3 +43,22 @@ export function broadcastReload(reason: string, data?: Record<string, unknown>):
|
||||
}
|
||||
}
|
||||
|
||||
export type UpdateStatusPhase = 'request_received' | 'update_started' | 'update_done';
|
||||
|
||||
export function broadcastUpdateStatus(phase: UpdateStatusPhase, data?: Record<string, unknown>): void {
|
||||
if (!wss) return;
|
||||
|
||||
const payload = JSON.stringify({
|
||||
type: 'update_status',
|
||||
ts: Date.now(),
|
||||
phase,
|
||||
...data,
|
||||
});
|
||||
|
||||
for (const client of wss.clients) {
|
||||
if (client.readyState === client.OPEN) {
|
||||
client.send(payload);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user