pub struct WebRunner { /* private fields */ }
Expand description
This is how eframe
runs your wepp application
This is cheap to clone.
See the crate level docs for an example.
Implementations§
source§impl WebRunner
impl WebRunner
sourcepub async fn start(
&self,
canvas_id: &str,
web_options: WebOptions,
app_creator: AppCreator
) -> Result<(), JsValue>
pub async fn start( &self, canvas_id: &str, web_options: WebOptions, app_creator: AppCreator ) -> Result<(), JsValue>
Create the application, install callbacks, and start running the app.
§Errors
Failing to initialize graphics.
sourcepub fn has_panicked(&self) -> bool
pub fn has_panicked(&self) -> bool
Has there been a panic?
sourcepub fn panic_summary(&self) -> Option<PanicSummary>
pub fn panic_summary(&self) -> Option<PanicSummary>
What was the panic message and callstack?
sourcepub fn app_mut<ConcreteApp: 'static + App>(
&self
) -> Option<RefMut<'_, ConcreteApp>>
pub fn app_mut<ConcreteApp: 'static + App>( &self ) -> Option<RefMut<'_, ConcreteApp>>
Get mutable access to the concrete App
we enclose.
This will panic if your app does not implement App::as_any_mut
,
and return None
if this runner has panicked.
sourcepub fn add_event_listener<E: JsCast>(
&self,
target: &EventTarget,
event_name: &'static str,
closure: impl FnMut(E, &mut AppRunner) + 'static
) -> Result<(), JsValue>
pub fn add_event_listener<E: JsCast>( &self, target: &EventTarget, event_name: &'static str, closure: impl FnMut(E, &mut AppRunner) + 'static ) -> Result<(), JsValue>
Convenience function to reduce boilerplate and ensure that all event handlers are dealt with in the same way.
All events added with this method will automatically be unsubscribed on panic,
or when Self::destroy
is called.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for WebRunner
impl !RefUnwindSafe for WebRunner
impl !Send for WebRunner
impl !Sync for WebRunner
impl Unpin for WebRunner
impl !UnwindSafe for WebRunner
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more