Struct yew::AppHandle [−][src]
pub struct AppHandle<COMP: Component> { /* fields omitted */ }
Expand description
An instance of an application.
Implementations
Methods from Deref<Target = Scope<COMP>>
Returns the parent scope
Returns the linked component if available
Send a message to the component.
Please be aware that currently this method synchronously schedules a call to the Component interface.
Send a batch of messages to the component.
This is useful for reducing re-renders of the components because the messages are handled together and the view function is called only once if needed.
Please be aware that currently this method synchronously schedules calls to the Component interface.
Creates a Callback
which will send a message to the linked
component’s update method when invoked.
Please be aware that currently the result of this callback synchronously schedules a call to the Component interface.
Creates a Callback
which will send a message to the linked
component’s update method when invoked.
Setting passive
to Some explicitly makes the event listener passive or not.
Yew sets sane defaults depending on the type of the listener.
See
addEventListener.
Please be aware that currently the result of this callback synchronously schedules a call to the Component interface.
Creates a Callback
from an FnOnce
which will send a message
to the linked component’s update method when invoked.
Please be aware that currently the result of this callback will synchronously schedule calls to the Component interface.
pub fn batch_callback<F, IN, OUT>(&self, function: F) -> Callback<IN> where
F: Fn(IN) -> OUT + 'static,
OUT: SendAsMessage<COMP>,
pub fn batch_callback<F, IN, OUT>(&self, function: F) -> Callback<IN> where
F: Fn(IN) -> OUT + 'static,
OUT: SendAsMessage<COMP>,
Creates a Callback
which will send a batch of messages back
to the linked component’s update method when invoked.
The callback function’s return type is generic to allow for dealing with both
Option
and Vec
nicely. Option
can be used when dealing with a callback that
might not need to send an update.
link.batch_callback(|_| vec![Msg::A, Msg::B]);
link.batch_callback(|_| Some(Msg::A));
Please be aware that currently the results of these callbacks will synchronously schedule calls to the Component interface.
pub fn batch_callback_once<F, IN, OUT>(&self, function: F) -> Callback<IN> where
F: FnOnce(IN) -> OUT + 'static,
OUT: SendAsMessage<COMP>,
pub fn batch_callback_once<F, IN, OUT>(&self, function: F) -> Callback<IN> where
F: FnOnce(IN) -> OUT + 'static,
OUT: SendAsMessage<COMP>,
Creates a Callback
from an FnOnce
which will send a batch of messages back
to the linked component’s update method when invoked.
The callback function’s return type is generic to allow for dealing with both
Option
and Vec
nicely. Option
can be used when dealing with a callback that
might not need to send an update.
link.batch_callback_once(|_| vec![Msg::A, Msg::B]);
link.batch_callback_once(|_| Some(Msg::A));
Please be aware that currently the results of these callbacks will synchronously schedule calls to the Component interface.
pub fn send_future<F, M>(&self, future: F) where
M: Into<COMP::Message>,
F: Future<Output = M> + 'static,
pub fn send_future<F, M>(&self, future: F) where
M: Into<COMP::Message>,
F: Future<Output = M> + 'static,
This method processes a Future that returns a message and sends it back to the component’s loop.
Panics
If the future panics, then the promise will not resolve, and will leak.
pub fn send_future_batch<F>(&self, future: F) where
F: Future<Output = Vec<COMP::Message>> + 'static,
pub fn send_future_batch<F>(&self, future: F) where
F: Future<Output = Vec<COMP::Message>> + 'static,
Registers a Future that resolves to multiple messages.
Panics
If the future panics, then the promise will not resolve, and will leak.