WebviewJS exposes a native desktop notification API that mirrors the familiar browserDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/webviewjs/webview/llms.txt
Use this file to discover all available pages before exploring further.
Notification interface. Under the hood it uses notify-rust, which delegates to each platform’s native notification system — macOS User Notifications, Windows Toast, or Linux/XDG D-Bus. Because WebviewJS runs as a native application rather than a sandboxed browser page, permission is always granted and requestPermission() is a no-op compatibility stub. Notifications can carry action buttons, inline images, and rich lifecycle event callbacks.
Android and iOS expose the full JavaScript
Notification API for source compatibility, but do not display a notification or emit native lifecycle events on those platforms.Permissions
Notification.permission is always "granted" for native desktop applications. requestPermission() exists solely for code that was written against the browser Web Notification API and returns immediately without prompting the user.Constructor
The heading text displayed prominently at the top of the notification.
Optional configuration for the notification body, icon, actions, and behaviour.
Static Members
Notification.permission
Always
"granted" — native applications are never subject to browser permission gates.Notification.requestPermission()
Resolves immediately with
"granted". Provided for compatibility with browser-targeted code.Instance Properties (readonly)
All constructor options are preserved as readonly instance properties.| Property | Type | Description |
|---|---|---|
title | string | Notification heading |
body | string | Body text |
icon | string | Icon path or platform name |
image | string | Buffer | Inline image |
badge | string | Badge icon |
tag | string | Grouping tag |
data | unknown | Application-defined data |
dir | "auto" | "ltr" | "rtl" | Text direction |
lang | string | Language tag |
renotify | boolean | Re-alert on same tag |
requireInteraction | boolean | Persist until interaction |
persistent | boolean | Keep process alive |
actions | NotificationAction[] | Action buttons |
silent | boolean | Suppress sound |
timestamp | number | Event timestamp (ms) |
vibrate | number | number[] | Vibration pattern |
Event Handler Properties
Assign functions directly for a familiar DOM-style interface:Methods
close()
Programmatically dismisses the notification where the platform supports it. Currently available through the Linux/XDG backend via notify-rust. On Windows and macOS the call is safe but performs no native close operation.
on(event, listener)
One of
"click", "close", "error", or "show".Callback invoked when the event fires.
The
Notification instance, for chaining.Events
Notification implements TypedEventEmitter<NotificationEventMap>. The full EventEmitter surface (on, once, off, addListener, removeListener, removeAllListeners, listenerCount, etc.) is available.
| Event | Trigger | Notes |
|---|---|---|
show | Native backend accepted the notification | May fire before the notification is visually displayed |
click | User activated the notification or an action button | event.action contains the action ID, or "" for default activation |
close | Backend reported dismissal, expiry, or native closure | |
error | Display or response handling failed | event.error is an Error instance |
NotificationEvent
The event name:
"click", "close", "error", or "show".The
Notification instance that emitted the event.For
click events: the action identifier of the button clicked, or "" for a default (body) click. undefined for other event types.For
error events: the underlying error. undefined for other event types.Platform Notes
macOS
macOS
Uses the macOS User Notifications framework.
requireInteraction keeps the notification banner on screen. Temporary PNG files are written for image buffers and cleaned up automatically.Windows
Windows
Uses the Windows Toast notification system. WebviewJS checks the global toast setting before submission and emits
error if notifications are disabled in Windows Settings. Temporary PNG files are written for image buffers.Linux
Linux
Uses the XDG/D-Bus notification protocol. Decoded image pixels are sent directly to the notification server.
close() is functional on this platform. Exact appearance depends on the desktop environment and notification daemon.Android / iOS
Android / iOS
The JavaScript API is fully exposed for source compatibility, but no notification is displayed and no lifecycle events are emitted.