remove some generics from LaunchBuilder
This commit is contained in:
1 parent
16e2c3f2f2
commit
25ad3da659
14 files changed
+142
-304
No files matched your search
@@ -60,7 +60,7 @@ use std::rc::Rc;
|
||||
pub use crate::cfg::Config;
|
||||
#[cfg(feature = "file_engine")]
|
||||
pub use crate::file_engine::WebFileEngineExt;
|
||||
use dioxus_core::{AnyProps, CrossPlatformConfig};
|
||||
use dioxus_core::VirtualDom;
|
||||
use futures_util::{
|
||||
future::{select, Either},
|
||||
pin_mut, FutureExt, StreamExt,
|
||||
@@ -99,13 +99,10 @@ mod rehydrate;
|
||||
/// wasm_bindgen_futures::spawn_local(app_fut);
|
||||
/// }
|
||||
/// ```
|
||||
pub async fn run_with_props<P: AnyProps>(
|
||||
dioxus_config: CrossPlatformConfig<P>,
|
||||
web_config: Config,
|
||||
) {
|
||||
pub async fn run(virtual_dom: VirtualDom, web_config: Config) {
|
||||
tracing::info!("Starting up");
|
||||
|
||||
let mut dom = dioxus_config.build_vdom();
|
||||
let mut dom = virtual_dom;
|
||||
|
||||
#[cfg(feature = "eval")]
|
||||
{
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
use dioxus_core::*;
|
||||
pub mod launch {
|
||||
use std::any::Any;
|
||||
|
||||
use crate::Config;
|
||||
use dioxus_core::prelude::*;
|
||||
|
||||
/// The web renderer platform
|
||||
pub struct WebPlatform;
|
||||
pub type Config = crate::Config;
|
||||
|
||||
impl<P: AnyProps> PlatformBuilder<P> for WebPlatform {
|
||||
type Config = Config;
|
||||
|
||||
fn launch(config: CrossPlatformConfig<P>, platform_config: Self::Config) {
|
||||
pub fn launch(
|
||||
root: fn() -> Element,
|
||||
contexts: Vec<Box<dyn Fn() -> Box<dyn Any> + Send>>,
|
||||
platform_config: Config,
|
||||
) {
|
||||
wasm_bindgen_futures::spawn_local(async move {
|
||||
crate::run_with_props(config, platform_config).await;
|
||||
let mut vdom = VirtualDom::new(root);
|
||||
for context in contexts {
|
||||
vdom.insert_any_root_context(context());
|
||||
}
|
||||
crate::run(vdom, platform_config).await;
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user