start migrating desktop to sledgehammer

This commit is contained in:
Evan Almloff committed 2023-10-13 09:21:57 -05:00
1 parent 1a4741ce04
commit 3063d83406
4 files changed
+11 -5

No files matched your search

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