mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-25 08:01:20 -08:00
Optimize bilibiliDanmuParseFromUrl function in artplayer-plugin-danmuku
This commit is contained in:
1 parent
e58285f2dd
commit
d57a13a2bd
4 files changed
+5
-2
No files matched your search
@@ -65,6 +65,7 @@ function createWorker() {
|
||||
}
|
||||
|
||||
export function bilibiliDanmuParseFromUrl(url) {
|
||||
// eslint-disable-next-line no-async-promise-executor
|
||||
return new Promise(async (resolve) => {
|
||||
const res = await fetch(url);
|
||||
const xml = await res.text();
|
||||
@@ -78,6 +79,7 @@ export function bilibiliDanmuParseFromUrl(url) {
|
||||
worker.terminate();
|
||||
};
|
||||
worker.postMessage({ xml, id: Date.now() });
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
} catch (error) {
|
||||
const danmus = bilibiliDanmuParseFromXml(xml);
|
||||
resolve(danmus);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { setStyle, isMobile } from '../utils';
|
||||
import { setStyle } from '../utils';
|
||||
import { getPosFromEvent } from './progress';
|
||||
|
||||
export default function thumbnails(options) {
|
||||
|
||||
Reference in new issue
Block a user