mirror of
https://github.com/home-assistant/frontend.git
synced 2026-04-17 07:34:21 +01:00
24 lines
589 B
TypeScript
24 lines
589 B
TypeScript
/**
|
|
* Broadcast connection status updates
|
|
*/
|
|
|
|
import type { HASSDomEvent } from "../common/dom/fire_event";
|
|
import { fireEvent } from "../common/dom/fire_event";
|
|
|
|
export type ConnectionStatus = "connected" | "auth-invalid" | "disconnected";
|
|
|
|
declare global {
|
|
// for fire event
|
|
interface HASSDomEvents {
|
|
"connection-status": ConnectionStatus;
|
|
}
|
|
|
|
interface GlobalEventHandlersEventMap {
|
|
"connection-status": HASSDomEvent<ConnectionStatus>;
|
|
}
|
|
}
|
|
|
|
export const broadcastConnectionStatus = (status: ConnectionStatus) => {
|
|
fireEvent(window, "connection-status", status);
|
|
};
|