fn start_runner(app_runner: AppRunner) -> Result<AppRunnerRef, JsValue> {
    let runner_container = AppRunnerContainer {
        runner: Arc::new(Mutex::new(app_runner)),
        panicked: Arc::new(AtomicBool::new(false)),
    };

    super::events::install_canvas_events(&runner_container)?;
    super::events::install_document_events(&runner_container)?;
    text_agent::install_text_agent(&runner_container)?;
    super::events::repaint_every_ms(&runner_container, 1000)?; // just in case. TODO(emilk): make it a parameter

    super::events::paint_and_schedule(&runner_container.runner, runner_container.panicked.clone())?;

    // Disable all event handlers on panic
    let previous_hook = std::panic::take_hook();
    let panicked = runner_container.panicked;
    std::panic::set_hook(Box::new(move |panic_info| {
        tracing::info!("egui disabled all event handlers due to panic");
        panicked.store(true, SeqCst);

        // Propagate panic info to the previously registered panic hook
        previous_hook(panic_info);
    }));

    Ok(runner_container.runner)
}
/// Install event listeners to register different input events
/// and starts running the given [`AppRunner`].
Install event listeners to register different input events
and starts running the given [`AppRunner`].
Install event listeners to register different input events and starts running the given [ ` AppRunner ` ] .
fn start_runner(app_runner: AppRunner) -> Result<AppRunnerRef, JsValue> {
    let runner_container = AppRunnerContainer {
        runner: Arc::new(Mutex::new(app_runner)),
        panicked: Arc::new(AtomicBool::new(false)),
    };
    super::events::install_canvas_events(&runner_container)?;
    super::events::install_document_events(&runner_container)?;
    text_agent::install_text_agent(&runner_container)?;
    super::events::repaint_every_ms(&runner_container, 1000)?; // just in case. TODO(emilk): make it a parameter
    super::events::paint_and_schedule(&runner_container.runner, runner_container.panicked.clone())?;
    // Disable all event handlers on panic
    let previous_hook = std::panic::take_hook();
    let panicked = runner_container.panicked;
    std::panic::set_hook(Box::new(move |panic_info| {
        tracing::info!("egui disabled all event handlers due to panic");
        panicked.store(true, SeqCst);
        // Propagate panic info to the previously registered panic hook
        previous_hook(panic_info);
    }));
    Ok(runner_container.runner)
}
fn start_runner ( app_runner : AppRunner ) -> Result < AppRunnerRef , JsValue > { let runner_container = AppRunnerContainer { runner : Arc :: new ( Mutex :: new ( app_runner ) ) , panicked : Arc :: new ( AtomicBool :: new ( false ) ) , } ; super :: events :: install_canvas_events ( & runner_container ) ? ; super :: events :: install_document_events ( & runner_container ) ? ; text_agent :: install_text_agent ( & runner_container ) ? ; super :: events :: repaint_every_ms ( & runner_container , 1000 ) ? ; // just in case. TODO(emilk): make it a parameter super :: events :: paint_and_schedule ( & runner_container . runner , runner_container . panicked . clone ( ) ) ? ; // Disable all event handlers on panic let previous_hook = std :: panic :: take_hook ( ) ; let panicked = runner_container . panicked ; std :: panic :: set_hook ( Box :: new ( move | panic_info | { tracing :: info ! ( " " ) ; panicked . store ( true , SeqCst ) ; // Propagate panic info to the previously registered panic hook previous_hook ( panic_info ) ; } ) ) ; Ok ( runner_container . runner ) }
Install event listeners to register different input events
and starts running the given [`AppRunner`].
Install event listeners to register different input events and starts running the given [ ` AppRunner ` ] .
app_runner
AppRunner
app_runner
AppRunner