Migrate behavior to global object

This commit is contained in:
Paulus Schoutsen 2016-05-28 11:16:40 -07:00
parent 502497bccb
commit 8af4e6eb3f
22 changed files with 26 additions and 43 deletions

View File

@ -1,10 +1,9 @@
import Polymer from '../polymer';
import nuclearObserver from '../util/bound-nuclear-behavior';
export default new Polymer({
is: 'entity-list',
behaviors: [nuclearObserver],
behaviors: [window.hassBehavior],
properties: {
hass: {

View File

@ -1,10 +1,9 @@
import Polymer from '../polymer';
import nuclearObserver from '../util/bound-nuclear-behavior';
export default new Polymer({
is: 'events-list',
behaviors: [nuclearObserver],
behaviors: [window.hassBehavior],
properties: {
hass: {

View File

@ -1,12 +1,11 @@
import Polymer from '../polymer';
import nuclearObserver from '../util/bound-nuclear-behavior';
require('./stream-status');
export default new Polymer({
is: 'ha-sidebar',
behaviors: [nuclearObserver],
behaviors: [window.hassBehavior],
properties: {
hass: {

View File

@ -1,10 +1,9 @@
import Polymer from '../polymer';
import nuclearObserver from '../util/bound-nuclear-behavior';
export default new Polymer({
is: 'ha-view-tabs',
behaviors: [nuclearObserver],
behaviors: [window.hassBehavior],
properties: {
hass: {

View File

@ -1,12 +1,11 @@
import Polymer from '../polymer';
import nuclearObserver from '../util/bound-nuclear-behavior';
require('./domain-icon');
export default new Polymer({
is: 'services-list',
behaviors: [nuclearObserver],
behaviors: [window.hassBehavior],
properties: {
hass: {

View File

@ -1,10 +1,9 @@
import Polymer from '../polymer';
import nuclearObserver from '../util/bound-nuclear-behavior';
export default new Polymer({
is: 'stream-status',
behaviors: [nuclearObserver],
behaviors: [window.hassBehavior],
properties: {
hass: {

View File

@ -1,10 +1,9 @@
import Polymer from '../polymer';
import nuclearObserver from '../util/bound-nuclear-behavior';
export default new Polymer({
is: 'ha-voice-command-dialog',
behaviors: [nuclearObserver],
behaviors: [window.hassBehavior],
properties: {
hass: {

View File

@ -1,5 +1,4 @@
import Polymer from '../polymer';
import nuclearObserver from '../util/bound-nuclear-behavior';
require('../state-summary/state-card-content');
require('../components/state-history-charts');
@ -10,7 +9,7 @@ const DOMAINS_WITH_NO_HISTORY = ['camera', 'configurator', 'scene'];
export default new Polymer({
is: 'more-info-dialog',
behaviors: [nuclearObserver],
behaviors: [window.hassBehavior],
properties: {
stateObj: {

View File

@ -2,13 +2,16 @@ import moment from 'moment';
import Polymer from './polymer';
import HomeAssistant from 'home-assistant-js';
import nuclearObserver from './util/bound-nuclear-behavior';
import validateAuth from './util/validate-auth';
import hassBehavior from './util/hass-behavior';
window.hassBehavior = hassBehavior;
window.moment = moment;
require('./layouts/login-form');
require('./layouts/home-assistant-main');
// While we figure out how ha-entity-marker can keep it's references
window.hass = new HomeAssistant();
export default new Polymer({
@ -19,7 +22,7 @@ export default new Polymer({
icons: null,
},
behaviors: [nuclearObserver],
behaviors: [window.hassBehavior],
properties: {
hass: {

View File

@ -1,6 +1,5 @@
import Polymer from '../polymer';
import nuclearObserver from '../util/bound-nuclear-behavior';
import removeInitMsg from '../util/remove-init-message';
require('../components/ha-sidebar');
@ -27,7 +26,7 @@ require('../dialogs/ha-voice-command-dialog');
export default new Polymer({
is: 'home-assistant-main',
behaviors: [nuclearObserver],
behaviors: [window.hassBehavior],
properties: {
hass: {

View File

@ -1,13 +1,12 @@
import Polymer from '../polymer';
import nuclearObserver from '../util/bound-nuclear-behavior';
import validateAuth from '../util/validate-auth';
import removeInitMsg from '../util/remove-init-message';
export default new Polymer({
is: 'login-form',
behaviors: [nuclearObserver],
behaviors: [window.hassBehavior],
properties: {
hass: {

View File

@ -1,5 +1,4 @@
import Polymer from '../polymer';
import nuclearObserver from '../util/bound-nuclear-behavior';
require('./partial-base');
require('../components/ha-cards');
@ -8,7 +7,7 @@ require('../components/ha-view-tabs');
export default new Polymer({
is: 'partial-cards',
behaviors: [nuclearObserver],
behaviors: [window.hassBehavior],
properties: {
hass: {

View File

@ -1,12 +1,11 @@
import Polymer from '../polymer';
import nuclearObserver from '../util/bound-nuclear-behavior';
require('./partial-base');
export default new Polymer({
is: 'partial-dev-info',
behaviors: [nuclearObserver],
behaviors: [window.hassBehavior],
properties: {
hass: {

View File

@ -1,12 +1,11 @@
import Polymer from '../polymer';
import nuclearObserver from '../util/bound-nuclear-behavior';
require('./partial-base');
export default new Polymer({
is: 'partial-dev-template',
behaviors: [nuclearObserver],
behaviors: [window.hassBehavior],
properties: {
hass: {

View File

@ -1,5 +1,4 @@
import Polymer from '../polymer';
import nuclearObserver from '../util/bound-nuclear-behavior';
require('./partial-base');
require('../components/state-history-charts');
@ -7,7 +6,7 @@ require('../components/state-history-charts');
export default new Polymer({
is: 'partial-history',
behaviors: [nuclearObserver],
behaviors: [window.hassBehavior],
properties: {
hass: {

View File

@ -1,5 +1,4 @@
import Polymer from '../polymer';
import nuclearObserver from '../util/bound-nuclear-behavior';
require('./partial-base');
require('../components/ha-logbook');
@ -8,7 +7,7 @@ require('../components/loading-box');
export default new Polymer({
is: 'partial-logbook',
behaviors: [nuclearObserver],
behaviors: [window.hassBehavior],
properties: {
hass: {

View File

@ -1,5 +1,4 @@
import Polymer from '../polymer';
import nuclearObserver from '../util/bound-nuclear-behavior';
require('../components/entity/ha-entity-marker');
@ -8,7 +7,7 @@ window.L.Icon.Default.imagePath = '/static/images/leaflet';
export default new Polymer({
is: 'partial-map',
behaviors: [nuclearObserver],
behaviors: [window.hassBehavior],
properties: {
hass: {

View File

@ -1,10 +1,9 @@
import Polymer from '../polymer';
import nuclearObserver from '../util/bound-nuclear-behavior';
export default new Polymer({
is: 'notification-manager',
behaviors: [nuclearObserver],
behaviors: [window.hassBehavior],
properties: {
hass: {

View File

@ -1,12 +1,11 @@
import Polymer from '../polymer';
import nuclearObserver from '../util/bound-nuclear-behavior';
require('../components/loading-box');
export default new Polymer({
is: 'more-info-configurator',
behaviors: [nuclearObserver],
behaviors: [window.hassBehavior],
properties: {
stateObj: {

View File

@ -1,5 +1,4 @@
import Polymer from '../polymer';
import nuclearObserver from '../util/bound-nuclear-behavior';
import dynamicContentUpdater from '../util/dynamic-content-updater';
import stateMoreInfoType from '../util/state-more-info-type';
@ -8,7 +7,7 @@ require('../state-summary/state-card-content');
export default new Polymer({
is: 'more-info-group',
behaviors: [nuclearObserver],
behaviors: [window.hassBehavior],
properties: {
hass: {

View File

@ -1,3 +0,0 @@
import nuclearObserver from './nuclear-behavior';
export default nuclearObserver;

View File

@ -16,7 +16,9 @@ export default {
let getter = this.properties[key].bindNuclear;
if (typeof getter !== 'function') {
/* eslint-disable no-console */
console.warn(`Component ${this.nodeName} uses old style bindNuclear`);
/* eslint-enable no-console */
} else {
getter = getter(hass);
}