Permission
requestPermission() resolves true when the user allows notifications. It must be called from a user gesture such as a click.
- In a shell, the shell asks the operating system, and the device’s push token does the rest.
- In a browser, it subscribes this browser to Web Push for your app’s origin. See Web Push for what that can and cannot do, notably on iOS.
Local notifications
schedule(payload) resolves { id } on success. Keep the id to cancel it later.
string
required
Notification title.
string
Notification text.
number | null
Delay before it fires.
null fires immediately.boolean
default:"false"
Repeat at the same interval.
Record<string, any>
Payload delivered with the notification.
boolean
default:"true"
Play the notification sound.
cancel(id) cancels one; cancelAll() cancels all of your app’s scheduled notifications.
Scheduling is shell-only. A web page has no dependable way to ask the system to wake it at a given time, so in a browser
schedule resolves { error: 'unsupported' }. Send the notification from your server instead.Badge
Inbox
The inbox lists the notifications the platform delivered to the user from your app. The shell scopes it to your app, so you never see another app’s notifications.{ id, senderSlug, title, body?, data?, read, createdAt }. When data holds { path, params }, tapping the notification opens that route in your app.
In a browser the inbox is always empty.
Functions
requestNotificationPermission, scheduleNotification, cancelNotification, cancelAllNotifications, getBadgeCount, setBadgeCount, getNotificationInbox, markInboxRead.