Helper function for calling JS's `requestAnimationFrame` with the given closure
(f: &Closure<dyn FnMut(f64)>)
| 17 | use std::time::Duration; |
| 18 | use wasm_bindgen::JsCast; |
| 19 | use wasm_bindgen::prelude::*; |
| 20 | use web_sys::{CanvasRenderingContext2d, HtmlCanvasElement, ImageData, window}; |
| 21 | |
| 22 | /// Helper function for calling JS's `requestAnimationFrame` with the given closure |
| 23 | pub(crate) fn request_animation_frame(f: &Closure<dyn FnMut(f64)>) { |
| 24 | web_sys::window() |
| 25 | .expect("No global `window` exists") |
| 26 | .request_animation_frame(f.as_ref().unchecked_ref()) |
| 27 | .expect("Failed to call `requestAnimationFrame`"); |
no test coverage detected