Function ambient_element::use_spawn

source ·
pub fn use_spawn<F: FnOnce(&mut World) -> R + Sync + Send + 'static, R: FnOnce(&mut World) + Sync + Send + 'static>(
    hooks: &mut Hooks<'_>,
    func: F
)
Expand description

Execute a function when the Element is mounted/rendered for the first time.

The function should return another function; that function will be called when the Element is unmounted.