mirror of
https://github.com/koel/koel
synced 2024-11-10 06:34:14 +00:00
Fix notification bug #67
This commit is contained in:
parent
e536ff6d35
commit
6457528990
1 changed files with 13 additions and 7 deletions
|
@ -94,14 +94,20 @@ export default {
|
|||
return;
|
||||
}
|
||||
|
||||
var notification = new Notification(`♫ ${song.title}`, {
|
||||
icon: song.album.cover,
|
||||
body: `${song.album.name} – ${song.album.artist.name}`
|
||||
});
|
||||
try {
|
||||
var notification = new Notification(`♫ ${song.title}`, {
|
||||
icon: song.album.cover,
|
||||
body: `${song.album.name} – ${song.album.artist.name}`
|
||||
});
|
||||
|
||||
window.setTimeout(() => {
|
||||
notification.close();
|
||||
}, 5000);
|
||||
notification.onclick = () => window.focus();
|
||||
|
||||
// Close the notif after 5 secs.
|
||||
window.setTimeout(() => notification.close(), 5000);
|
||||
} catch (e) {
|
||||
// Notification fails.
|
||||
// @link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/showNotification
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue