Make launch functions pub (#1288)
* Make launch functions pub * add docs to web, desktop, and server launch functions --------- Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
This commit is contained in:
1 parent
c6ec2a9a9b
commit
92a8669e14
1 file changed
+6
-5
@@ -119,21 +119,22 @@ impl<Props: Clone + serde::Serialize + serde::de::DeserializeOwned + Send + Sync
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "web")]
|
#[cfg(feature = "web")]
|
||||||
fn launch_web(self) {
|
/// Launch the web application
|
||||||
|
pub fn launch_web(self) {
|
||||||
let cfg = self.web_cfg.hydrate(true);
|
let cfg = self.web_cfg.hydrate(true);
|
||||||
dioxus_web::launch_with_props(self.component, get_root_props_from_document().unwrap(), cfg);
|
dioxus_web::launch_with_props(self.component, get_root_props_from_document().unwrap(), cfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "desktop")]
|
#[cfg(feature = "desktop")]
|
||||||
fn launch_desktop(self) {
|
/// Launch the web application
|
||||||
|
pub fn launch_desktop(self) {
|
||||||
let cfg = self.desktop_cfg;
|
let cfg = self.desktop_cfg;
|
||||||
dioxus_desktop::launch_with_props(self.component, self.props, cfg);
|
dioxus_desktop::launch_with_props(self.component, self.props, cfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Launch a server with the given configuration
|
|
||||||
/// This will use the routing integration of the currently enabled integration feature
|
|
||||||
#[cfg(feature = "ssr")]
|
#[cfg(feature = "ssr")]
|
||||||
async fn launch_server(self) {
|
/// Launch a server application
|
||||||
|
pub async fn launch_server(self) {
|
||||||
let addr = self.addr;
|
let addr = self.addr;
|
||||||
println!("Listening on {}", addr);
|
println!("Listening on {}", addr);
|
||||||
let cfg = self.server_cfg.build();
|
let cfg = self.server_cfg.build();
|
||||||
|
|||||||
Reference in new issue
Block a user