Desktop Notifications
This page describes how to show native desktop notifications.

The framework provides API that allows you to show native desktop notifications on Windows, macOS, and Linux.
Different platforms have different notification systems. On macOS, you will see the notification in the notification center. On Windows, you will see the notification in the system tray. On Linux, you will see the notification in the notification area.
The following example shows how to create and show a notification with an action button:
import { app, Notification } from '@mobrowser/api';
const notification = new Notification({
title: 'A new update is available',
body: 'A new update is ready. Restart the app to apply the update.',
icon: app.getPath('appResources') + '/icon.png',
actions: [
{
text: 'Restart',
action: (_notification: Notification) => { app.restart() }
}
]
})
notification.show()
Platform considerations
macOS
When you run the application and show a notification for the first time, macOS will ask you to allow notifications. If you don’t allow notifications from your application, the notification will not be shown.
You can allow notifications by clicking on the “Allow” button in the notification permission dialog. Alternatively, you can allow notifications by going to System Settings > Notifications > Application and enabling the Allow notifications option.
