Get the document provider for the current platform or a no-op provider if the platform doesn't document functionality.
()
| 12 | |
| 13 | /// Get the document provider for the current platform or a no-op provider if the platform doesn't document functionality. |
| 14 | pub fn document() -> Rc<dyn Document> { |
| 15 | match dioxus_core::try_consume_context::<Rc<dyn Document>>() { |
| 16 | Some(document) => document, |
| 17 | None => { |
| 18 | tracing::error!( |
| 19 | "Unable to find a document in the renderer. Using the default no-op document." |
| 20 | ); |
| 21 | Rc::new(NoOpDocument) |
| 22 | } |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | /// Evaluate some javascript in the current document |
| 27 | #[doc = include_str!("../docs/eval.md")] |