Function start

Source
pub fn start<F>(window: &Window, main_loop_function: F)
where F: FnMut(FrameState) + 'static,
Expand description

Runs the closure provided with requestAnimationFrame every possible frame

Use it as:

use web_sys_main_loop::{start, FrameState};

let window = web_sys::window().unwrap();
...
start(&window, move |frame_state: FrameState| {
    ...
});