Add basic Desktop notifications for game start + new move + game over
[vchess.git] / client / src / utils / notifications.js
1 // https://developer.mozilla.org/en-US/docs/Web/API/notification
2 export function notify(title, options) {
3 if (Notification.permission === "granted")
4 new Notification(title, options);
5 else if (Notification.permission !== 'denied') {
6 Notification.requestPermission(function (permission) {
7 if(!('permission' in Notification))
8 Notification.permission = permission;
9 if (permission === "granted")
10 var notification = new Notification(title, options);
11 });
12 }
13 }