Skip to main content

Module notification

Module notification 

Source
Expand description

Notifications: calling the user from outside the window.

A transient message speaks inside the window, for a few seconds, about something the user just did. A notification speaks outside it, about something the user did not do (a long job finished, something is waiting for an answer), and stays until the user clears it. Its moment is precisely when nobody is looking at the window.

The Host does not call the platform. The Renderer owns the platform, so what crosses is a command record in an ordinary batch, and what comes back is an ordinary event. That keeps one way in to the Host (the Renderer’s UI thread) and keeps every platform binding on the side that already has the window.

A notification is usually a worker’s news: the session ended on a worker thread, so that is where the application learns it. NotificationSender is Send for that reason. What it posts waits in a queue inside the Host, the Host asks for a frame the way it does for any worker’s change, and the next batch carries it. Nothing here is a queue on the boundary: the boundary still only sees a batch handed over inside a call.

Structs§

ActivationSubscription
An activation handler’s registration. Dropping it removes the handler.
Notification
One notification, built and then posted.
NotificationActivation
What the user pressed.
NotificationSender
A handle a worker thread posts notifications through.
PermissionSubscription
A registration for changes of the notification permission. Dropping it ends the registration, so a runtime keeps it for as long as the reader it wakes is alive.

Functions§

notification_permission
The permission the Renderer last reported. Available outside a component too.
on_activation
Runs handler when the user presses a notification this application posted, for as long as the returned registration is kept.
request_notification_permission
Asks for permission to show notifications now, rather than on the first one posted.
subscribe_permission
Registers notify to be called each time the Renderer reports a different permission. The Dioxus adapter’s use_notification_permission hook holds one.
unsupported_reason
What usually stands between this platform and a notification, for the one debug line.
withdraw_notification
Takes back the notification posted under key.