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);
}
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
. ↩
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.