mirror of
https://github.com/rust-windowing/winit.git
synced 2026-06-28 07:33:14 -04:00
Implement web_sys::Canvas event listeners
This commit is contained in:
@@ -1,11 +1,16 @@
|
||||
mod canvas;
|
||||
mod document;
|
||||
mod event;
|
||||
mod timeout;
|
||||
|
||||
pub use self::canvas::Canvas;
|
||||
pub use self::document::Document;
|
||||
pub use self::timeout::Timeout;
|
||||
|
||||
use crate::platform::web::WindowExtWebSys;
|
||||
use crate::window::Window;
|
||||
use web_sys::HtmlCanvasElement;
|
||||
|
||||
pub fn request_animation_frame<F>(f: F)
|
||||
where
|
||||
F: Fn(),
|
||||
@@ -15,3 +20,9 @@ where
|
||||
pub fn throw(msg: &str) {
|
||||
wasm_bindgen::throw_str(msg);
|
||||
}
|
||||
|
||||
impl WindowExtWebSys for Window {
|
||||
fn canvas(&self) -> HtmlCanvasElement {
|
||||
self.window.canvas().raw().clone()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user