use async/await

This commit is contained in:
Harvey committed 2022-04-29 18:04:50 +08:00
1 parent facf8876b5
commit e34d09a99c
9 files changed
+86 -102

No files matched your search

+6 -7
View File
@@ -50,15 +50,14 @@ export default class Subtitle extends Component {
}
}
switch(url, newOption = {}) {
async switch(url, newOption = {}) {
const { i18n, notice, option } = this.art;
const subtitleOption = { ...option.subtitle, ...newOption, url };
return this.init(subtitleOption).then((subUrl) => {
if (newOption.name) {
notice.show = `${i18n.get('Switch Subtitle')}: ${newOption.name}`;
}
return subUrl;
});
const subUrl = await this.init(subtitleOption);
if (newOption.name) {
notice.show = `${i18n.get('Switch Subtitle')}: ${newOption.name}`;
}
return subUrl;
}
init(subtitleOption) {