Fix ES2015 syntax in media-player-model

This commit is contained in:
Paulus Schoutsen 2017-07-01 14:57:19 -07:00
parent cf6bddd7a9
commit 594f143ad0

View File

@ -132,27 +132,27 @@
}); });
Object.assign(window.MediaPlayerEntity.prototype, { Object.assign(window.MediaPlayerEntity.prototype, {
mediaPlayPause() { mediaPlayPause: function () {
this.callService('media_play_pause'); this.callService('media_play_pause');
}, },
nextTrack() { nextTrack: function () {
this.callService('media_next_track'); this.callService('media_next_track');
}, },
playbackControl() { playbackControl: function () {
this.callService('media_play_pause'); this.callService('media_play_pause');
}, },
previousTrack() { previousTrack: function () {
this.callService('media_previous_track'); this.callService('media_previous_track');
}, },
setVolume(volume) { setVolume: function (volume) {
this.callService('volume_set', { volume_level: volume }); this.callService('volume_set', { volume_level: volume });
}, },
togglePower() { togglePower: function () {
if (this.isOff) { if (this.isOff) {
this.turnOn(); this.turnOn();
} else { } else {
@ -160,32 +160,32 @@
} }
}, },
turnOff() { turnOff: function () {
this.callService('turn_off'); this.callService('turn_off');
}, },
turnOn() { turnOn: function () {
this.callService('turn_on'); this.callService('turn_on');
}, },
volumeDown() { volumeDown: function () {
this.callService('volume_down'); this.callService('volume_down');
}, },
volumeMute(mute) { volumeMute: function (mute) {
if (!this.supportsVolumeMute) { if (!this.supportsVolumeMute) {
throw new Error('Muting volume not supported'); throw new Error('Muting volume not supported');
} }
this.callService('volume_mute', { is_volume_muted: mute }); this.callService('volume_mute', { is_volume_muted: mute });
}, },
volumeUp() { volumeUp: function () {
this.callService('volume_up'); this.callService('volume_up');
}, },
// helper method // helper method
callService(service, data) { callService: function (service, data) {
var serviceData = data || {}; var serviceData = data || {};
serviceData.entity_id = this.stateObj.entity_id; serviceData.entity_id = this.stateObj.entity_id;
this.hass.callService('media_player', service, serviceData); this.hass.callService('media_player', service, serviceData);