diff --git a/README.md b/README.md index 141b976..74c3d64 100644 --- a/README.md +++ b/README.md @@ -128,7 +128,7 @@ let draw = { // Create a black RGBA background let bg = Rgba::from_bytes([0, 0, 0, !0]); - // Lazily create a layer + // Lazily initialize a layer let layer = layer.get_or_init(|| cx.make_layer(&shader, frame.format())); frame diff --git a/dunge/src/window.rs b/dunge/src/window.rs index 10a7d49..f24f787 100644 --- a/dunge/src/window.rs +++ b/dunge/src/window.rs @@ -78,6 +78,7 @@ impl WindowState { } } + /// Runs an event loop. pub fn run(self, cx: Context, upd: U) -> Result<(), LoopError> where U: Update + 'static, @@ -85,6 +86,7 @@ impl WindowState { el::run(self, cx, upd) } + /// Locally runs an event loop. #[cfg(not(target_arch = "wasm32"))] pub fn run_local(self, cx: Context, upd: U) -> Result<(), LoopError> where @@ -106,11 +108,13 @@ impl WindowState { } } +/// Creates a new [`WindowState`]. #[cfg(all(feature = "winit", not(target_arch = "wasm32")))] pub fn window() -> WindowState { state(Element(())) } +/// Creates a [`WindowState`] from an HTML element. #[cfg(all(feature = "winit", target_arch = "wasm32"))] pub fn from_element(id: &str) -> WindowState { use web_sys::Window; diff --git a/examples/window/src/main.rs b/examples/window/src/main.rs index c59fd81..bd98417 100644 --- a/examples/window/src/main.rs +++ b/examples/window/src/main.rs @@ -91,7 +91,7 @@ async fn run() -> Result<(), Error> { // Create a black RGBA background let bg = Rgba::from_bytes([0, 0, 0, !0]); - // Lazily create a layer + // Lazily initialize a layer let layer = layer.get_or_init(|| cx.make_layer(&shader, frame.format())); frame