Replace switch in controls.createProgress with object literal

This commit is contained in:
Albin Larsson 2018-06-15 17:06:36 +02:00
parent 2a186e425b
commit 99c10aa1fc

17
src/js/controls.js vendored
View File

@ -331,19 +331,12 @@ const controls = {
if (type !== 'volume') { if (type !== 'volume') {
progress.appendChild(createElement('span', null, '0')); progress.appendChild(createElement('span', null, '0'));
let suffix = ''; const suffixKey = ({
switch (type) { played: 'played',
case 'played': buffer: 'buffered',
suffix = i18n.get('played', this.config); })[type];
break;
case 'buffer': const suffix = suffixKey ? i18n.get(suffixKey, this.config) : '';
suffix = i18n.get('buffered', this.config);
break;
default:
break;
}
progress.innerText = `% ${suffix.toLowerCase()}`; progress.innerText = `% ${suffix.toLowerCase()}`;
} }