fix multiple types of desktop/liveview listeners in the same app

This commit is contained in:
Evan Almloff committed 2023-10-24 13:09:10 -05:00
1 parent 9abc390d04
commit 9de56c00f3
2 files changed
+6 -2

No files matched your search

+4 -1
View File
@@ -276,7 +276,10 @@ pub fn launch_with_props<P: 'static>(root: Component<P>, props: P, cfg: Config)
let evt = match serde_json::from_value::<HtmlEvent>(params) {
Ok(value) => value,
Err(_) => return,
Err(err) => {
tracing::error!("Error parsing user_event: {:?}", err);
return;
}
};
let HtmlEvent {
@@ -355,7 +355,7 @@ pub mod binary_protocol {
fn add_placeholder() {
"{node = document.createElement('pre'); node.hidden = true; stack.push(node);}"
}
fn new_event_listener(event_name: &str<u8, evt>, id: u32, bubbles: u8) {
fn new_event_listener(event: &str<u8, evt>, id: u32, bubbles: u8) {
r#"
bubbles = bubbles == 1;
node = nodes[id];
@@ -365,6 +365,7 @@ pub mod binary_protocol {
node.listening = 1;
}
node.setAttribute('data-dioxus-id', `\${id}`);
const event_name = $event$;
// if this is a mounted listener, we send the event immediately
if (event_name === "mounted") {