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§
- Activation
Subscription - An activation handler’s registration. Dropping it removes the handler.
- Notification
- One notification, built and then posted.
- Notification
Activation - What the user pressed.
- Notification
Sender - A handle a worker thread posts notifications through.
- Permission
Subscription - 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
handlerwhen 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
notifyto be called each time the Renderer reports a different permission. The Dioxus adapter’suse_notification_permissionhook 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.