wip: start to refactor out hot reloading from packages

Also implement alternative simpler template system
This commit is contained in:
Jonathan Kelley committed 2022-10-20 09:56:09 -07:00
1 parent 3b7b503333
commit 90982e0ccb
44 files changed
+3865 -5133

No files matched your search

+23 -21
View File
@@ -50,34 +50,36 @@ impl DesktopController {
dom.base_scope().provide_context(window_context);
// allow other proccesses to send the new rsx text to the @dioxusin ipc channel and recieve erros on the @dioxusout channel
#[cfg(any(feature = "hot-reload", debug_assertions))]
crate::hot_reload::init(&dom);
todo!()
let edits = dom.rebuild();
// // allow other proccesses to send the new rsx text to the @dioxusin ipc channel and recieve erros on the @dioxusout channel
// #[cfg(any(feature = "hot-reload", debug_assertions))]
// crate::hot_reload::init(&dom);
edit_queue
.lock()
.unwrap()
.push(serde_json::to_string(&edits.edits).unwrap());
// let edits = dom.rebuild();
// Make sure the window is ready for any new updates
proxy.send_event(UserWindowEvent::Update).unwrap();
// edit_queue
// .lock()
// .unwrap()
// .push(serde_json::to_string(&edits.edits).unwrap());
loop {
dom.wait_for_work().await;
// // Make sure the window is ready for any new updates
// proxy.send_event(UserWindowEvent::Update).unwrap();
let muts = dom.work_with_deadline(|| false);
// loop {
// dom.wait_for_work().await;
for edit in muts {
edit_queue
.lock()
.unwrap()
.push(serde_json::to_string(&edit.edits).unwrap());
}
// let muts = dom.work_with_deadline(|| false);
let _ = proxy.send_event(UserWindowEvent::Update);
}
// for edit in muts {
// edit_queue
// .lock()
// .unwrap()
// .push(serde_json::to_string(&edit.edits).unwrap());
// }
// let _ = proxy.send_event(UserWindowEvent::Update);
// }
})
});
+6 -5
View File
@@ -1,4 +1,4 @@
use dioxus_core::{SchedulerMsg, SetTemplateMsg, VirtualDom};
use dioxus_core::{SchedulerMsg, VirtualDom};
use interprocess::local_socket::{LocalSocketListener, LocalSocketStream};
use std::io::{BufRead, BufReader};
use std::time::Duration;
@@ -32,10 +32,11 @@ pub(crate) fn init(dom: &VirtualDom) {
let mut buf = String::new();
match conn.read_line(&mut buf) {
Ok(_) => {
let msg: SetTemplateMsg = serde_json::from_str(&buf).unwrap();
channel
.start_send(SchedulerMsg::SetTemplate(Box::new(msg)))
.unwrap();
todo!()
// let msg: SetTemplateMsg = serde_json::from_str(&buf).unwrap();
// channel
// .start_send(SchedulerMsg::SetTemplate(Box::new(msg)))
// .unwrap();
}
Err(err) => {
if err.kind() != std::io::ErrorKind::WouldBlock {