feat: upgrade syntax
This commit is contained in:
1 parent
574d7fdb9e
commit
fd93ee89c1
64 files changed
+522
-437
No files matched your search
@@ -1,7 +1,6 @@
|
||||
use std::cell::RefCell;
|
||||
|
||||
use dioxus::prelude::Scope;
|
||||
use dioxus::ScopeChildren;
|
||||
use dioxus_core as dioxus;
|
||||
use dioxus_core::{Context, Element, LazyNodes, NodeFactory, Properties};
|
||||
use dioxus_core_macro::Props;
|
||||
@@ -44,7 +43,7 @@ pub struct WebviewWindowProps<'a> {
|
||||
/// focuse me
|
||||
onfocused: &'a dyn FnMut(()),
|
||||
|
||||
children: ScopeChildren<'a>,
|
||||
children: Element,
|
||||
}
|
||||
|
||||
/// A handle to a
|
||||
@@ -57,7 +56,7 @@ pub struct WebviewWindowProps<'a> {
|
||||
///
|
||||
///
|
||||
///
|
||||
pub fn WebviewWindow((cx, props): Scope<WebviewWindowProps>) -> Element {
|
||||
pub fn WebviewWindow(cx: Context, props: &WebviewWindowProps) -> Element {
|
||||
let dtcx = cx.consume_state::<RefCell<DesktopContext>>()?;
|
||||
|
||||
cx.use_hook(
|
||||
@@ -91,7 +90,7 @@ fn syntax_works() {
|
||||
use dioxus_hooks::*;
|
||||
use dioxus_html as dioxus_elements;
|
||||
|
||||
static App: FC<()> = |(cx, props)| {
|
||||
static App: FC<()> = |cx, props| {
|
||||
cx.render(rsx! {
|
||||
// left window
|
||||
WebviewWindow {
|
||||
|
||||
@@ -166,7 +166,7 @@ pub fn run<T: 'static + Send + Sync>(
|
||||
sender.unbounded_send(SchedulerMsg::UiEvent(event)).unwrap();
|
||||
|
||||
if let Some(BridgeEvent::Update(edits)) = rx.blocking_recv() {
|
||||
log::info!("bridge received message {:?}", edits);
|
||||
log::info!("bridge received message");
|
||||
Some(RpcResponse::new_result(req.id.take(), Some(edits)))
|
||||
} else {
|
||||
log::info!("none received message");
|
||||
@@ -276,7 +276,7 @@ pub(crate) fn launch_vdom_with_tokio<P: Send + 'static>(
|
||||
|
||||
runtime.block_on(async move {
|
||||
let mut vir = VirtualDom::new_with_props_and_scheduler(root, props, sender, receiver);
|
||||
let _ = vir.get_event_sender();
|
||||
let _ = vir.get_scheduler_channel();
|
||||
|
||||
let edits = vir.rebuild();
|
||||
|
||||
@@ -298,14 +298,13 @@ pub(crate) fn launch_vdom_with_tokio<P: Send + 'static>(
|
||||
// todo: maybe we want to schedule ourselves in
|
||||
// on average though, the virtualdom running natively is stupid fast
|
||||
|
||||
let mut muts = vir.run_with_deadline(|| false);
|
||||
let mut muts = vir.work_with_deadline(|| false);
|
||||
|
||||
log::debug!("finished running with deadline");
|
||||
|
||||
let mut edits = vec![];
|
||||
|
||||
while let Some(edit) = muts.pop() {
|
||||
log::debug!("sending message on channel with edit {:?}", edit);
|
||||
let edit_string = serde_json::to_value(Evt { edits: edit.edits })
|
||||
.expect("serializing edits should never fail");
|
||||
edits.push(edit_string);
|
||||
|
||||
Reference in new issue
Block a user