Trait EventProvider
pub trait EventProvider: Provider {
// Required methods
fn subscribe(
&self,
target: &AppTarget,
filter: EventFilter,
) -> Result<Subscription, Error>;
fn wait_for_event(
&self,
target: &AppTarget,
filter: EventFilter,
timeout: Duration,
) -> Result<Event, Error>;
fn wait_for(
&self,
target: &AppTarget,
selector: &str,
state: ElementState,
timeout: Duration,
) -> Result<Node, Error>;
}Expand description
Optional trait for backends that support event subscriptions. Extends Provider with reactive capabilities.
Required Methods§
fn subscribe(
&self,
target: &AppTarget,
filter: EventFilter,
) -> Result<Subscription, Error>
fn subscribe( &self, target: &AppTarget, filter: EventFilter, ) -> Result<Subscription, Error>
Subscribe to events matching the given filter.
Returns a stream of events and a handle to manage the subscription.
Dropping the Subscription unsubscribes automatically (RAII).
fn wait_for_event(
&self,
target: &AppTarget,
filter: EventFilter,
timeout: Duration,
) -> Result<Event, Error>
fn wait_for_event( &self, target: &AppTarget, filter: EventFilter, timeout: Duration, ) -> Result<Event, Error>
Wait for a single event matching the filter, with timeout.