Web Notifications allow to notice the user outside the application.
Need desktop-notification
permission in manifest.webapp
, which for an installed application will be allowed by default and doesn't need to request for current origin permission to display system notifications.
"desktop-notification": {
"description": "Explain the user that you want to annoy him/her."
}
Notification object accept a title and many other options. See constructor.
Simple example:
if (Notification && Notification.permission === 'granted') {
const title = "Hello World";
const body = "The quick brown fox jumps over the lazy dog";
const notification = new Notification(title, { body });
notification.addEventListener('click', () => {
notification.close();
});
}