More timing tweaks. Fix #105 again

This commit is contained in:
Thomas Lovén 2020-06-11 11:36:06 +02:00
parent f94d0466f6
commit 74146540ff
3 changed files with 17 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@ -47,6 +47,10 @@ class BrowserPlayer extends LitElement {
}
render() {
if(!window.browser_mod) {
window.setTimeout(() => this.requestUpdate(), 100);
return html``;
}
const player = window.browser_mod.player;
return html`
<ha-card>

View File

@ -49,12 +49,20 @@ class BrowserMod {
}
}
_connect() {
if(!window.hassConnection) {
window.setTimeout(() => this._connect(), 100);
} else {
window.hassConnection.then((conn) => this.connect(conn.conn));
}
}
constructor() {
this.entity_id = deviceID.replace("-","_");
this.cast = document.querySelector("hc-main") !== null;
if(!this.cast) {
window.setTimeout(this._load_lovelace.bind(this), 500);
window.hassConnection.then((conn) => this.connect(conn.conn));
this._connect();
document.querySelector("home-assistant").addEventListener("hass-more-info", this.popup_card.bind(this));
} else {
this.connect(hass().connection);