autonomous.contact/public/js/notifications.js
Andy Burke 9ab3950502 feature: add qr codes to the invite popup
feature: starting work on notifications
fix: some styling updates
2026-02-04 11:28:00 -08:00

29 lines
601 B
JavaScript

const NOTIFICATIONS = {
_notifications: [],
send: function (message, options = {}) {
if (!Notification || Notification.permission !== "granted") {
return;
}
const notification = new Notification(message, options);
this._notifications.push( notification );
return notification;
},
close: function() {
for ( const notification of this._notifications ) {
notification?.close();
}
this._notifications.length = 0;
},
request_permission: function () {
if (Notification && Notification.permission === "granted") {
return;
}
Notification.requestPermission();
},
};