Merge remote-tracking branch 'upstream/master'
This commit is contained in:
16
js/main.js
16
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() {
|
||||
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);
|
||||
@@ -444,4 +452,8 @@ class BrowserMod {
|
||||
|
||||
}
|
||||
|
||||
window.browser_mod = window.browser_mod || new BrowserMod();
|
||||
|
||||
const bases = [customElements.whenDefined('home-assistant-main'), customElements.whenDefined('hui-view')];
|
||||
Promise.race(bases).then(() => {
|
||||
window.browser_mod = window.browser_mod || new BrowserMod();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user