mirror of
https://github.com/koel/koel
synced 2024-11-27 22:40:26 +00:00
Merge branch 'master' into lastfm
This commit is contained in:
commit
9f6e46371e
1 changed files with 13 additions and 7 deletions
|
@ -96,14 +96,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