fix formatting
This commit is contained in:
1 parent
28d71624ef
commit
083ccd765c
1 file changed
+7
-5
@@ -14,22 +14,24 @@ pub fn in_runtime<R>(runtime: Rc<Runtime>, f: impl FnOnce() -> R) -> R {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Override the current runtime. This must be used to override the current runtime when importing components from a dynamic library that has it's own runtime.
|
/// Override the current runtime. This must be used to override the current runtime when importing components from a dynamic library that has it's own runtime.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// use dioxus::prelude::*;
|
/// use dioxus::prelude::*;
|
||||||
///
|
///
|
||||||
/// fn main() {
|
/// fn main() {
|
||||||
/// let virtual_dom = VirtualDom::new(app);
|
/// let virtual_dom = VirtualDom::new(app);
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// fn app(cx: Scope) -> Element {
|
/// fn app(cx: Scope) -> Element {
|
||||||
/// render!{ Component { runtime: Runtime::current().unwrap() } }
|
/// render!{ Component { runtime: Runtime::current().unwrap() } }
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// // In a dynamic library
|
/// // In a dynamic library
|
||||||
/// #[inline_props]
|
/// #[inline_props]
|
||||||
/// fn Component(cx: Scope, runtime: Rc<Runtime>) -> Element {
|
/// fn Component(cx: Scope, runtime: std::rc::Rc<Runtime>) -> Element {
|
||||||
/// cx.use_hook(|| override_runtime(runtime.clone()));
|
/// cx.use_hook(|| override_runtime(runtime.clone()));
|
||||||
|
///
|
||||||
|
/// render! { div {} }
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
pub fn override_runtime(runtime: Rc<Runtime>) {
|
pub fn override_runtime(runtime: Rc<Runtime>) {
|
||||||
|
|||||||
Reference in new issue
Block a user