chore: rename all &cx to cx, make clipppy happy

This commit is contained in:
Jonathan Kelley committed 2022-12-07 13:11:40 -08:00
1 parent e8133e9449
commit 4eefc3f854
85 files changed
+256 -271

No files matched your search

+4 -5
View File
@@ -7,13 +7,12 @@
//! - tests to ensure dyn_into works for various event types.
//! - Partial delegation?>
use dioxus_core::{ElementId, Mutation, Mutations, Template, TemplateAttribute, TemplateNode};
use dioxus_core::{Mutation, Template};
use dioxus_html::{event_bubbles, CompositionData, FormData};
use dioxus_interpreter_js::Interpreter;
use futures_channel::mpsc;
use js_sys::Function;
use std::{any::Any, rc::Rc};
use wasm_bindgen::{closure::Closure, JsCast, JsValue};
use wasm_bindgen::{closure::Closure, JsCast};
use web_sys::{Document, Element, Event};
use crate::Config;
@@ -61,7 +60,7 @@ impl WebsysDom {
let i = &self.interpreter;
for edit in edits.drain(..) {
match edit {
AppendChildren { id, m } => i.AppendChildren(m as u32),
AppendChildren { id, m } => i.AppendChildren(m as u32, id.0 as u32),
AssignId { path, id } => i.AssignId(path, id.0 as u32),
CreatePlaceholder { id } => i.CreatePlaceholder(id.0 as u32),
CreateTextNode { value, id } => i.CreateTextNode(value.into(), id.0 as u32),
@@ -81,7 +80,7 @@ impl WebsysDom {
i.SetBoolAttribute(id.0 as u32, name, value)
}
SetText { value, id } => i.SetText(id.0 as u32, value.into()),
NewEventListener { name, scope, id } => {
NewEventListener { name, id, .. } => {
self.interpreter.NewEventListener(
name,
id.0 as u32,
+2 -11
View File
@@ -53,15 +53,11 @@
// - Do the VDOM work during the idlecallback
// - Do DOM work in the next requestAnimationFrame callback
use std::time::Duration;
pub use crate::cfg::Config;
use crate::dom::virtual_event_from_websys_event;
pub use crate::util::use_eval;
use dioxus_core::{Element, ElementId, Scope, VirtualDom};
use futures_channel::mpsc::unbounded;
use futures_util::{pin_mut, FutureExt, StreamExt};
use gloo_timers::future::sleep;
mod cache;
mod cfg;
@@ -181,7 +177,7 @@ pub async fn run_with_props<T: 'static>(root: fn(Scope<T>) -> Element, root_prop
wasm_bindgen::intern(s);
}
let should_hydrate = cfg.hydrate;
let _should_hydrate = cfg.hydrate;
let (tx, mut rx) = futures_channel::mpsc::unbounded();
@@ -193,8 +189,6 @@ pub async fn run_with_props<T: 'static>(root: fn(Scope<T>) -> Element, root_prop
// } else {
let edits = dom.rebuild();
log::debug!("Initial edits {:#?}", edits);
websys_dom.load_templates(&edits.templates);
websys_dom.apply_edits(edits.edits);
@@ -214,9 +208,8 @@ pub async fn run_with_props<T: 'static>(root: fn(Scope<T>) -> Element, root_prop
futures_util::select! {
_ = work => None,
new_template = hotreload_rx.next() => {
_new_template = hotreload_rx.next() => {
todo!("Implement hot reload");
None
}
evt = rx.next() => evt
}
@@ -251,8 +244,6 @@ pub async fn run_with_props<T: 'static>(root: fn(Scope<T>) -> Element, root_prop
// wait for the animation frame to fire so we can apply our changes
work_loop.wait_for_raf().await;
log::debug!("edits {:#?}", edits);
websys_dom.load_templates(&edits.templates);
websys_dom.apply_edits(edits.edits);
}