wip: remove runner on hook and then update docs
This commit is contained in:
1 parent
7d41a16208
commit
d1560450ba
95 files changed
+1339
-675
No files matched your search
@@ -59,14 +59,7 @@ pub struct WebviewWindowProps<'a> {
|
||||
pub fn WebviewWindow(cx: Scope<WebviewWindowProps>) -> Element {
|
||||
let dtcx = cx.consume_state::<RefCell<DesktopContext>>()?;
|
||||
|
||||
cx.use_hook(
|
||||
|_| {
|
||||
//
|
||||
},
|
||||
|state| {
|
||||
//
|
||||
},
|
||||
);
|
||||
cx.use_hook(|_| {});
|
||||
|
||||
// render the children directly
|
||||
todo!()
|
||||
|
||||
@@ -4,17 +4,8 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<!-- enable for mobile support -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0 maximum-scale=1.0 user-scalable=no"
|
||||
charset="utf-8" />
|
||||
<!-- <style>
|
||||
body,
|
||||
html {
|
||||
position: fixed;
|
||||
}
|
||||
</style> -->
|
||||
<link rel="stylesheet" href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css">
|
||||
<script src="https://cdn.plot.ly/plotly-1.52.3.min.js"></script>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" charset="utf-8" />
|
||||
<!-- <meta name="viewport" content="width=device-width, initial-scale=1.0 maximum-scale=1.0 user-scalable=no" charset="utf-8" /> -->
|
||||
</head>
|
||||
|
||||
|
||||
|
||||
@@ -54,6 +54,11 @@ function serialize_event(event) {
|
||||
case "submit": {
|
||||
let target = event.target;
|
||||
let value = target.value ?? target.textContent;
|
||||
|
||||
if (target.type == "checkbox") {
|
||||
value = target.checked ? "true" : "false";
|
||||
}
|
||||
|
||||
return {
|
||||
value: value
|
||||
};
|
||||
@@ -310,32 +315,24 @@ class Interpreter {
|
||||
element.setAttribute(`dioxus-event-${event_name}`, `${scope}.${mounted_node_id}`);
|
||||
|
||||
if (this.listeners[event_name] === undefined) {
|
||||
this.listeners[event_name] = "bla";
|
||||
this.listeners[event_name] = true;
|
||||
|
||||
this.root.addEventListener(event_name, (event) => {
|
||||
// console.log("CLICKED");
|
||||
console.log("handling event", event);
|
||||
|
||||
const target = event.target;
|
||||
const real_id = target.getAttribute(`dioxus-id`);
|
||||
if (real_id == null) {
|
||||
alert("no id");
|
||||
return;
|
||||
}
|
||||
|
||||
// const fields = val.split(".");
|
||||
// const scope_id = parseInt(fields[0]);
|
||||
// const real_id = parseInt(fields[1]);
|
||||
|
||||
// // console.log(`parsed event with scope_id ${scope_id} and real_id ${real_id}`);
|
||||
|
||||
// console.log("message fired");
|
||||
let contents = serialize_event(event);
|
||||
let evt = {
|
||||
rpc.call('user_event', {
|
||||
event: event_name,
|
||||
// scope: scope_id,
|
||||
mounted_dom_id: parseInt(real_id),
|
||||
contents: contents,
|
||||
};
|
||||
contents: serialize_event(event),
|
||||
});
|
||||
|
||||
rpc.call('user_event', evt);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user