Skip to main content

on_activation

Function on_activation 

Source
pub fn on_activation(
    handler: Rc<dyn Fn(NotificationActivation)>,
) -> ActivationSubscription
Expand description

Runs handler when the user presses a notification this application posted, for as long as the returned registration is kept.

One registration for the whole application rather than a callback per notification. A notification stays in the notification centre for hours, long after whatever posted it is gone, so what it carries back is the key it was posted under. The Dioxus adapter’s use_notification_activated hook holds one of these for a component.

With no handler registered, an activation is dropped.