Function on_cleanup

pub fn on_cleanup(fun: impl FnOnce() + Send + Sync + 'static)
Expand description

Registers a function to be run the next time the current owner is cleaned up.

Because the ownership model is associated with reactive nodes, each “decision point” in an application tends to have a separate Owner: as a result, these cleanup functions often fill the same need as an “on unmount” function in other UI approaches, etc.

This is an alias for Owner::on_cleanup.