mirror of
https://github.com/storytold/winit.git
synced 2026-11-23 04:40:45 +01:00
Draft web platform structure
This commit is contained in:
1 parent
eea9530f38
commit
c5703eb00a
26 files changed
+1171
-153
No files matched your search
@@ -0,0 +1,20 @@
|
||||
pub struct Canvas;
|
||||
|
||||
impl Canvas {
|
||||
pub fn new() -> Self {
|
||||
let element = document()
|
||||
.create_element("canvas")
|
||||
.map_err(|_| os_error!(OsError("Failed to create canvas element".to_owned())))?;
|
||||
|
||||
let canvas: CanvasElement = element
|
||||
.try_into()
|
||||
.map_err(|_| os_error!(OsError("Failed to create canvas element".to_owned())))?;
|
||||
|
||||
document()
|
||||
.body()
|
||||
.ok_or_else(|| os_error!(OsError("Failed to find body node".to_owned())))?
|
||||
.append_child(&canvas);
|
||||
|
||||
Canvas(canvas)
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
Reference in new issue
Block a user