Discord add reconnecting functionality

Clear rpc on disconnect
Add menu button to reconnect
This commit is contained in:
Constantin Piber
2021-08-27 16:32:55 +02:00
parent 36bc9c62b0
commit b5fd6b4969
3 changed files with 168 additions and 78 deletions

View File

@ -40,6 +40,9 @@ const getArtist = async (win) => {
}
// Fill songInfo with empty values
/**
* @typedef {songInfo} SongInfo
*/
const songInfo = {
title: "",
artist: "",
@ -71,6 +74,14 @@ const handleData = async (responseText, win) => {
const callbacks = [];
// This function will allow plugins to register callback that will be triggered when data changes
/**
* @callback songInfoCallback
* @param {songInfo} songInfo
* @returns {void}
*/
/**
* @param {songInfoCallback} callback
*/
const registerCallback = (callback) => {
callbacks.push(callback);
};