Переглянути джерело

Feat: buff up examples and docs

Jonathan Kelley 4 роки тому
батько
коміт
8d3e2ad
2 змінених файлів з 9 додано та 2 видалено
  1. 0 2
      packages/web/examples/hello.rs
  2. 9 0
      packages/web/src/lib.rs

+ 0 - 2
packages/web/examples/hello.rs

@@ -2,8 +2,6 @@ use dioxus_core::prelude::*;
 use dioxus_web::WebsysRenderer;
 
 fn main() {
-    // todo: set this up so the websys render can spawn itself rather than having to wrap it
-    // almost like bundling an executor with the wasm version
     wasm_bindgen_futures::spawn_local(WebsysRenderer::start(Example));
 }
 

+ 9 - 0
packages/web/src/lib.rs

@@ -25,6 +25,15 @@ pub struct WebsysRenderer {
 }
 
 impl WebsysRenderer {
+    /// This method is the primary entrypoint for Websys Dioxus apps. Will panic if an error occurs while rendering.
+    /// See DioxusErrors for more information on how these errors could occour.
+    ///
+    /// ```ignore
+    /// fn main() {
+    ///     wasm_bindgen_futures::spawn_local(WebsysRenderer::start(Example));
+    /// }
+    /// ```
+    ///
     /// Run the app to completion, panicing if any error occurs while rendering.
     /// Pairs well with the wasm_bindgen async handler
     pub async fn start(root: FC<()>) {