feat: proper handling of events
This commit is contained in:
1 parent
c7d2d9d050
commit
d7940aa2ac
7 files changed
+116
-62
No files matched your search
@@ -7,9 +7,9 @@ use dioxus_core::{
|
||||
DomEdit, ElementId, ScopeId,
|
||||
};
|
||||
use fxhash::FxHashMap;
|
||||
use wasm_bindgen::{closure::Closure, JsCast};
|
||||
use wasm_bindgen::{closure::Closure, JsCast, JsValue};
|
||||
use web_sys::{
|
||||
window, CssStyleDeclaration, Document, Element, Event, HtmlElement, HtmlInputElement,
|
||||
window, Attr, CssStyleDeclaration, Document, Element, Event, HtmlElement, HtmlInputElement,
|
||||
HtmlOptionElement, Node, NodeList, UiEvent,
|
||||
};
|
||||
|
||||
@@ -264,8 +264,8 @@ impl WebsysDom {
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
el.set_attribute(&format!("dioxus-event"), &format!("{}", event))
|
||||
.unwrap();
|
||||
// el.set_attribute(&format!("dioxus-event"), &format!("{}", event))
|
||||
// .unwrap();
|
||||
|
||||
// Register the callback to decode
|
||||
|
||||
@@ -532,11 +532,11 @@ fn decode_trigger(event: &web_sys::Event) -> anyhow::Result<UserEvent> {
|
||||
|
||||
log::debug!("Event type is {:?}", typ);
|
||||
|
||||
// let attrs = target.attributes();
|
||||
// for x in 0..attrs.length() {
|
||||
// let attr = attrs.item(x).unwrap();
|
||||
// log::debug!("attrs include: {:#?}", attr);
|
||||
// }
|
||||
let attrs = target.attributes();
|
||||
for x in 0..attrs.length() {
|
||||
let attr: Attr = attrs.item(x).unwrap();
|
||||
log::debug!("attrs include: {:#?}, {:#?}", attr.name(), attr.value());
|
||||
}
|
||||
|
||||
use anyhow::Context;
|
||||
|
||||
|
||||
@@ -152,6 +152,8 @@ pub async fn run_with_props<T: Properties + 'static>(root: FC<T>, root_props: T,
|
||||
// run the virtualdom work phase until the frame deadline is reached
|
||||
let mutations = dom.run_with_deadline(|| (&mut deadline).now_or_never().is_some());
|
||||
|
||||
log::debug!("received mutations {:#?}", mutations);
|
||||
|
||||
// wait for the animation frame to fire so we can apply our changes
|
||||
work_loop.wait_for_raf().await;
|
||||
|
||||
|
||||
Reference in new issue
Block a user