fix: notification closing

This commit is contained in:
JellyBrick
2024-01-16 21:13:07 +09:00
parent 9d136c8dd5
commit de6506e6b4

View File

@ -29,8 +29,6 @@ export default (
const sendNotification = (songInfo: SongInfo) => { const sendNotification = (songInfo: SongInfo) => {
const iconSrc = notificationImage(songInfo, config()); const iconSrc = notificationImage(songInfo, config());
savedNotification?.close();
let icon: string; let icon: string;
if (typeof iconSrc === 'object') { if (typeof iconSrc === 'object') {
icon = iconSrc.toDataURL(); icon = iconSrc.toDataURL();
@ -50,6 +48,9 @@ export default (
toastXml: getXml(songInfo, icon), toastXml: getXml(songInfo, icon),
}); });
// To fix the notification not closing
setTimeout(() => savedNotification?.close(), 5000);
savedNotification.on('close', () => { savedNotification.on('close', () => {
savedNotification = undefined; savedNotification = undefined;
}); });