mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-25 08:01:20 -08:00
use async/await
This commit is contained in:
1 parent
facf8876b5
commit
e34d09a99c
9 files changed
+86
-102
No files matched your search
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user