Use async over debounce in importHref

This commit is contained in:
Paulus Schoutsen 2016-07-28 09:21:02 -07:00
parent 0d01baf8f6
commit 974c75b9ed

View File

@ -87,27 +87,25 @@ Polymer({
this.resolved = false; this.resolved = false;
this.errorLoading = false; this.errorLoading = false;
// Debounced otherwise importHref will add an HTML import to the DOM this.importHref(
// which blocks painting till loaded. panel.get('url'),
this.debounce('import-panel', function () {
this.importHref(
panel.get('url'),
function success() { function success() {
window.hassUtil.dynamicContentUpdater( window.hassUtil.dynamicContentUpdater(
this.$.panel, 'ha-panel-' + panel.get('component_name'), { this.$.panel, 'ha-panel-' + panel.get('component_name'), {
hass: this.hass, hass: this.hass,
narrow: this.narrow, narrow: this.narrow,
showMenu: this.showMenu, showMenu: this.showMenu,
panel: panel.toJS(), panel: panel.toJS(),
}); });
this.resolved = true; this.resolved = true;
}.bind(this), }.bind(this),
function error() { function error() {
this.errorLoading = true; this.errorLoading = true;
}.bind(this)); }.bind(this),
}.bind(this));
true /* async */);
}, },
updateAttributes: function () { updateAttributes: function () {