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