Function ambient_api::prelude::ambient_element::use_module_message
source · pub fn use_module_message<T>(
hooks: &mut Hooks<'_>,
func: impl Fn(&mut World, MessageContext, &T) + Sync + Send + 'static
)where
T: ModuleMessage,
Expand description
Register a function to be called when a ModuleMessage is received.
The subscription will be automatically cancelled when this Element is unmounted.