Notification
This part of the runtime provides access to native system notifications with support for interactive elements like action buttons and text input fields.
InitializeNotifications
Initializes the notification system. It should be called during app startup.
Go: InitializeNotifications(ctx context.Context) error
JavaScript: InitializeNotifications(): Promise<void>
Returns: Error if initialization fails
Example:
err := runtime.InitializeNotifications(ctx)
if err != nil {
log.Fatal(err)
}
await runtime.InitializeNotifications();
IsNotificationAvailable
Checks if notifications are supported on the current platform.
Go: IsNotificationAvailable(ctx context.Context) bool
JavaScript: IsNotificationAvailable(): Promise<boolean>
Returns: true if notifications are supported, false otherwise
Example:
if !runtime.IsNotificationAvailable(ctx) {
log.Println("Notifications not available on this platform")
}
const available = await runtime.IsNotificationAvailable();
if (!available) {
console.log("Notifications not available on this platform");
}