18 lines
391 B
JavaScript
18 lines
391 B
JavaScript
const NOTIFICATIONS = {
|
|
send: function (message, options = {}) {
|
|
if (!Notification || Notification.permission !== "granted") {
|
|
return;
|
|
}
|
|
|
|
const notification = new Notification(message, options);
|
|
return notification;
|
|
},
|
|
|
|
request_permissions: function () {
|
|
if (Notification && Notification.permission === "granted") {
|
|
return;
|
|
}
|
|
|
|
Notification.requestPermission();
|
|
},
|
|
};
|