mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-13 11:21:46 +00:00
chore(song-info): change from array to Set
change from `array` to `Set` to prevent the duplicate callback from being stored
This commit is contained in:
@ -93,11 +93,11 @@ const handleData = async (
|
||||
|
||||
// This variable will be filled with the callbacks once they register
|
||||
export type SongInfoCallback = (songInfo: SongInfo, event?: string) => void;
|
||||
const callbacks: SongInfoCallback[] = [];
|
||||
const callbacks: Set<SongInfoCallback> = new Set();
|
||||
|
||||
// This function will allow plugins to register callback that will be triggered when data changes
|
||||
const registerCallback = (callback: SongInfoCallback) => {
|
||||
callbacks.push(callback);
|
||||
callbacks.add(callback);
|
||||
};
|
||||
|
||||
let handlingData = false;
|
||||
|
||||
Reference in New Issue
Block a user