ha-frontend-cdce8p/src/app-core.js
Paulus Schoutsen 43940d067a Remove last ES6
2016-07-18 21:28:42 -07:00

36 lines
1022 B
JavaScript

import HomeAssistant from '../home-assistant-js/src/index';
const hass = new HomeAssistant();
window.validateAuth = function validateAuth(authToken, rememberAuth) {
hass.authActions.validate(authToken, {
rememberAuth,
useStreaming: hass.localStoragePreferences.useStreaming,
});
};
window.removeInitMsg = function removeInitMessage() {
// remove the HTML init message
const initMsg = document.getElementById('ha-init-skeleton');
if (initMsg) {
initMsg.parentElement.removeChild(initMsg);
}
};
hass.reactor.batch(function () {
hass.navigationActions.showSidebar(
hass.localStoragePreferences.showSidebar);
// if auth was given, tell the backend
if (window.noAuth) {
window.validateAuth('', false);
} else if (hass.localStoragePreferences.authToken) {
window.validateAuth(hass.localStoragePreferences.authToken, true);
}
});
setTimeout(hass.startLocalStoragePreferencesSync, 5000);
// While we figure out how ha-entity-marker can keep it's references
window.hass = hass;