[][src]Trait emscripten_main_loop::MainLoop

pub trait MainLoop {
    fn main_loop(&mut self) -> MainLoopEvent;

A trait that abstracts a main loop mechanism that can be used on native targets as well as the wasm32-unknown-emscripten target. The purpose of this is to get around the browser limitations that prevent you from just naively looping, which would cause the browser tab to be frozen/killed. Use this by implementing the trait on the data object that contains all data that should be available to the main loop

Required methods

fn main_loop(&mut self) -> MainLoopEvent

Will be run once per loop iteration. Functionally equivalent to the body of a loop statement. Use the return value to indicate if the loop should continue or terminate.

Loading content...


Loading content...