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') {
progress.appendChild(createElement('span', null, '0'));
let suffix = '';
switch (type) {
case 'played':
suffix = i18n.get('played', this.config);
break;
const suffixKey = ({
played: 'played',
buffer: 'buffered',
})[type];
case 'buffer':
suffix = i18n.get('buffered', this.config);
break;
default:
break;
}
const suffix = suffixKey ? i18n.get(suffixKey, this.config) : '';
progress.innerText = `% ${suffix.toLowerCase()}`;
}