NotificationOptions
The options for constructing a Notification.
import { NotificationOptions } from '@mobrowser/api';
Example
import { Notification } from '@mobrowser/api';
const notification = new Notification({
title: 'New message',
body: 'You have a new message from John.',
icon: '/path/to/icon.png',
sound: 'Basso',
actions: [
{ text: 'Reply', action: (n) => console.log('Reply') },
{ text: 'Dismiss', action: (n) => n.dismiss() }
]
})
notification.show()
Properties
title
readonly title?: string;
The title of the notification.
body
readonly body?: string;
The body text of the notification.
subtitle
readonly subtitle?: string;
The subtitle of the notification. Available only on macOS.
actions
readonly actions?: NotificationAction[];
The action buttons to display in the notification.
selectActions
readonly selectActions?: NotificationSelectAction[];
The select actions to display in the Windows toast notification.
hasReply
readonly hasReply?: boolean;
Whether the notification includes a reply input field. Available only on macOS and Windows.
silent
readonly silent?: boolean;
Whether the notification is silent (plays no sound when displayed).
timeoutType
readonly timeoutType?: TimeoutType;
The timeout behavior of the notification.
replyPlaceholder
readonly replyPlaceholder?: string;
The placeholder text for the reply input field.
sound
readonly sound?: string;
The name of the sound to play when the notification is displayed.
Available only on macOS and Linux.
The value is a name, not a file path, and its meaning is platform-specific:
macOS — passed directly to NSSound by name (no file extension).
The system searches for the sound file in the following directories, in order:
~/Library/Sounds//Library/Sounds//Network/Library/Sounds//System/Library/Sounds/
Built-in system sound names: Basso, Blow, Bottle, Frog, Funk,
Glass, Hero, Morse, Ping, Pop, Purr, Sosumi, Submarine, Tink.
To use a custom sound, place an .aiff, .wav, or .mp3 file in
~/Library/Sounds/ and pass its base name (without extension).
Linux — used as a freedesktop.org Sound Theme
event name, passed as the sound-name hint to the notification daemon.
Sound files are resolved from XDG sound theme directories such as
/usr/share/sounds/<theme>/ or ~/.local/share/sounds/<theme>/.
Common predefined event names: message-new-instant, message-new-email,
complete, phone-incoming-call, dialog-warning, dialog-error,
dialog-information, bell.
The default sound (message-new-instant) is used when this option is omitted.
Set NotificationOptions.silent to true to suppress sound entirely.
Windows — not applicable; use NotificationOptions.silent to
suppress the default system sound.
urgency
readonly urgency?: Urgency;
The urgency level of the notification. Available only on Linux.
icon
readonly icon?: string;
The absolute path to the notification icon image file.
Supported formats: PNG, JPEG. HiDPI variants (e.g. icon@2x.png) are
automatically loaded when available.
closeButtonText
readonly closeButtonText?: string;
The text of the close button. Available only on macOS.