pub trait EventLoopExtWebSys {
type UserEvent: 'static;
// Required methods
fn spawn_app<A: ApplicationHandler<Self::UserEvent> + 'static>(self, app: A);
fn spawn<F>(self, event_handler: F)
where F: 'static + FnMut(Event<Self::UserEvent>, &ActiveEventLoop);
fn set_poll_strategy(&self, strategy: PollStrategy);
fn poll_strategy(&self) -> PollStrategy;
fn set_wait_until_strategy(&self, strategy: WaitUntilStrategy);
fn wait_until_strategy(&self) -> WaitUntilStrategy;
}
web_platform
only.Expand description
Additional methods on EventLoop
that are specific to the web.
Required Associated Types§
Required Methods§
Sourcefn spawn_app<A: ApplicationHandler<Self::UserEvent> + 'static>(self, app: A)
fn spawn_app<A: ApplicationHandler<Self::UserEvent> + 'static>(self, app: A)
Initializes the winit event loop.
Unlike
run_app()
1, this returns immediately, and doesn’t throw an exception in order to
satisfy its !
return type.
Once the event loop has been destroyed, it’s possible to reinitialize another event loop by calling this function again. This can be useful if you want to recreate the event loop while the WebAssembly module is still loaded. For example, this can be used to recreate the event loop when switching between tabs on a single page application.
run_app()
is not available on WASM when the target supportsexception-handling
. ↩
Sourcefn spawn<F>(self, event_handler: F)
👎Deprecated: use EventLoopExtWebSys::spawn_app
fn spawn<F>(self, event_handler: F)
See spawn_app
.
Sourcefn set_poll_strategy(&self, strategy: PollStrategy)
fn set_poll_strategy(&self, strategy: PollStrategy)
Sets the strategy for ControlFlow::Poll
.
See PollStrategy
.
Sourcefn poll_strategy(&self) -> PollStrategy
fn poll_strategy(&self) -> PollStrategy
Gets the strategy for ControlFlow::Poll
.
See PollStrategy
.
Sourcefn set_wait_until_strategy(&self, strategy: WaitUntilStrategy)
fn set_wait_until_strategy(&self, strategy: WaitUntilStrategy)
Sets the strategy for ControlFlow::WaitUntil
.
See WaitUntilStrategy
.
Sourcefn wait_until_strategy(&self) -> WaitUntilStrategy
fn wait_until_strategy(&self) -> WaitUntilStrategy
Gets the strategy for ControlFlow::WaitUntil
.
See WaitUntilStrategy
.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.