start migrating desktop to sledgehammer
This commit is contained in:
1 parent
1a4741ce04
commit
3063d83406
4 files changed
+11
-5
No files matched your search
@@ -12,7 +12,7 @@ keywords = ["dom", "ui", "gui", "react"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
dioxus-core = { workspace = true, features = ["serialize"] }
|
dioxus-core = { workspace = true, features = ["serialize"] }
|
||||||
dioxus-html = { workspace = true, features = ["serialize", "native-bind"] }
|
dioxus-html = { workspace = true, features = ["serialize", "native-bind"] }
|
||||||
dioxus-interpreter-js = { workspace = true }
|
dioxus-interpreter-js = { workspace = true, features = ["sledgehammer"]}
|
||||||
dioxus-hot-reload = { workspace = true, optional = true }
|
dioxus-hot-reload = { workspace = true, optional = true }
|
||||||
|
|
||||||
serde = "1.0.136"
|
serde = "1.0.136"
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ use dioxus_core::ScopeState;
|
|||||||
use dioxus_core::VirtualDom;
|
use dioxus_core::VirtualDom;
|
||||||
#[cfg(all(feature = "hot-reload", debug_assertions))]
|
#[cfg(all(feature = "hot-reload", debug_assertions))]
|
||||||
use dioxus_hot_reload::HotReloadMsg;
|
use dioxus_hot_reload::HotReloadMsg;
|
||||||
use dioxus_interpreter_js::Channel;
|
|
||||||
use slab::Slab;
|
use slab::Slab;
|
||||||
use wry::application::accelerator::Accelerator;
|
use wry::application::accelerator::Accelerator;
|
||||||
use wry::application::event::Event;
|
use wry::application::event::Event;
|
||||||
|
|||||||
@@ -53,10 +53,11 @@ fn module_loader(root_name: &str) -> String {
|
|||||||
|
|
||||||
pub(super) fn desktop_handler(
|
pub(super) fn desktop_handler(
|
||||||
request: &Request<Vec<u8>>,
|
request: &Request<Vec<u8>>,
|
||||||
|
responder: wry::http::response::Responder,
|
||||||
custom_head: Option<String>,
|
custom_head: Option<String>,
|
||||||
custom_index: Option<String>,
|
custom_index: Option<String>,
|
||||||
root_name: &str,
|
root_name: &str,
|
||||||
) -> Result<Response<Cow<'static, [u8]>>> {
|
) {
|
||||||
// If the request is for the root, we'll serve the index.html file.
|
// If the request is for the root, we'll serve the index.html file.
|
||||||
if request.uri().path() == "/" {
|
if request.uri().path() == "/" {
|
||||||
// If a custom index is provided, just defer to that, expecting the user to know what they're doing.
|
// If a custom index is provided, just defer to that, expecting the user to know what they're doing.
|
||||||
|
|||||||
@@ -44,8 +44,14 @@ pub fn build(
|
|||||||
_ = proxy.send_event(UserWindowEvent(EventData::Ipc(message), window.id()));
|
_ = proxy.send_event(UserWindowEvent(EventData::Ipc(message), window.id()));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.with_custom_protocol(String::from("dioxus"), move |r| {
|
.with_asynchronous_custom_protocol("dioxus".into(), move |r, responder| {
|
||||||
protocol::desktop_handler(r, custom_head.clone(), index_file.clone(), &root_name)
|
protocol::desktop_handler(
|
||||||
|
r,
|
||||||
|
responder,
|
||||||
|
custom_head.clone(),
|
||||||
|
index_file.clone(),
|
||||||
|
&root_name,
|
||||||
|
)
|
||||||
})
|
})
|
||||||
.with_file_drop_handler(move |window, evet| {
|
.with_file_drop_handler(move |window, evet| {
|
||||||
file_handler
|
file_handler
|
||||||
|
|||||||
Reference in new issue
Block a user