More timing tweaks. Fix #105 again
This commit is contained in:
parent
f94d0466f6
commit
74146540ff
File diff suppressed because one or more lines are too long
@ -47,6 +47,10 @@ class BrowserPlayer extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
if(!window.browser_mod) {
|
||||||
|
window.setTimeout(() => this.requestUpdate(), 100);
|
||||||
|
return html``;
|
||||||
|
}
|
||||||
const player = window.browser_mod.player;
|
const player = window.browser_mod.player;
|
||||||
return html`
|
return html`
|
||||||
<ha-card>
|
<ha-card>
|
||||||
|
10
js/main.js
10
js/main.js
@ -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() {
|
constructor() {
|
||||||
this.entity_id = deviceID.replace("-","_");
|
this.entity_id = deviceID.replace("-","_");
|
||||||
this.cast = document.querySelector("hc-main") !== null;
|
this.cast = document.querySelector("hc-main") !== null;
|
||||||
if(!this.cast) {
|
if(!this.cast) {
|
||||||
window.setTimeout(this._load_lovelace.bind(this), 500);
|
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));
|
document.querySelector("home-assistant").addEventListener("hass-more-info", this.popup_card.bind(this));
|
||||||
} else {
|
} else {
|
||||||
this.connect(hass().connection);
|
this.connect(hass().connection);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user