Skip to content

Commit

Permalink
Fix client issue by returning empty div instead of undefined + fix co…
Browse files Browse the repository at this point in the history
…nditional headers
  • Loading branch information
tbouron committed Dec 26, 2019
1 parent 6fde412 commit a620dba
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions MMM-Sonos.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,16 @@ Module.register('MMM-Sonos', {
},

getHeader: function() {
if (this.config.headers && Object.values(this.items).some(item => item.state === 'playing' && item.track)) {
return this.config.headers;
} else {
return '';
if (this.data.header && Object.values(this.items).some(item => item.state === 'playing' && item.track)) {
return this.data.header;
}
},

getDom: function () {
if (Object.values(this.items).length === 0) {
return document.createElement('div');
}

const container = document.createElement('div');
container.className = 'sonos light';
container.append(...Object.values(this.items)
Expand Down

0 comments on commit a620dba

Please sign in to comment.