mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 18:41:47 +00:00
fix: dispatch event
This commit is contained in:
@ -107,6 +107,8 @@ export default (api: YoutubePlayer) => {
|
||||
const waitingEvent = new Set<string>();
|
||||
// Name = "dataloaded" and abit later "dataupdated"
|
||||
api.addEventListener('videodatachange', (name: string, videoData) => {
|
||||
document.dispatchEvent(new CustomEvent('videodatachange', { detail: { name, videoData } }));
|
||||
|
||||
if (name === 'dataupdated' && waitingEvent.has(videoData.videoId)) {
|
||||
waitingEvent.delete(videoData.videoId);
|
||||
sendSongInfo(videoData);
|
||||
|
||||
Reference in New Issue
Block a user