mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 17:56:46 +00:00
Fix demo suspend once and for all (#6219)
This commit is contained in:
parent
44210ce6f2
commit
7637d36146
@ -114,6 +114,7 @@ export const provideHass = (
|
||||
);
|
||||
|
||||
const localLanguage = getLocalLanguage();
|
||||
const noop = () => undefined;
|
||||
|
||||
const hassObj: MockHomeAssistant = {
|
||||
// Home Assistant properties
|
||||
@ -123,8 +124,8 @@ export const provideHass = (
|
||||
},
|
||||
} as any,
|
||||
connection: {
|
||||
addEventListener: () => undefined,
|
||||
removeEventListener: () => undefined,
|
||||
addEventListener: noop,
|
||||
removeEventListener: noop,
|
||||
sendMessage: (msg) => {
|
||||
const callback = wsCommands[msg.type];
|
||||
|
||||
@ -168,6 +169,8 @@ export const provideHass = (
|
||||
);
|
||||
};
|
||||
},
|
||||
suspendReconnectUntil: noop,
|
||||
suspend: noop,
|
||||
socket: {
|
||||
readyState: WebSocket.OPEN,
|
||||
},
|
||||
|
@ -78,7 +78,7 @@ export class HomeAssistantAppEl extends HassElement {
|
||||
|
||||
document.addEventListener(
|
||||
"visibilitychange",
|
||||
() => this.__handleVisibilityChange(),
|
||||
() => this._handleVisibilityChange(),
|
||||
false
|
||||
);
|
||||
}
|
||||
@ -148,7 +148,7 @@ export class HomeAssistantAppEl extends HassElement {
|
||||
: route.path.substr(1, dividerPos - 1);
|
||||
}
|
||||
|
||||
private __handleVisibilityChange() {
|
||||
protected _handleVisibilityChange() {
|
||||
if (document.hidden) {
|
||||
// If the document is hidden, we will prevent reconnects until we are visible again
|
||||
this.hass!.connection.suspendReconnectUntil(
|
||||
|
Loading…
x
Reference in New Issue
Block a user