wip: add html event type
This commit is contained in:
1 parent
fa3d1ef574
commit
e256fe1079
17 files changed
+340
-245
No files matched your search
@@ -18,6 +18,7 @@ use std::sync::Arc;
|
||||
|
||||
use desktop_context::UserWindowEvent;
|
||||
pub use desktop_context::{use_eval, use_window, DesktopContext, EvalResult};
|
||||
use dioxus_html::HtmlEvent;
|
||||
use futures_channel::mpsc::UnboundedSender;
|
||||
pub use wry;
|
||||
pub use wry::application as tao;
|
||||
@@ -156,7 +157,7 @@ fn build_webview(
|
||||
is_ready: Arc<AtomicBool>,
|
||||
proxy: tao::event_loop::EventLoopProxy<UserWindowEvent>,
|
||||
eval_sender: tokio::sync::mpsc::UnboundedSender<serde_json::Value>,
|
||||
event_tx: UnboundedSender<serde_json::Value>,
|
||||
event_tx: UnboundedSender<HtmlEvent>,
|
||||
) -> wry::webview::WebView {
|
||||
let builder = cfg.window.clone();
|
||||
let window = builder.build(event_loop).unwrap();
|
||||
@@ -190,7 +191,9 @@ fn build_webview(
|
||||
eval_sender.send(result).unwrap();
|
||||
}
|
||||
"user_event" => {
|
||||
_ = event_tx.unbounded_send(message.params());
|
||||
if let Ok(evt) = serde_json::from_value(message.params()) {
|
||||
_ = event_tx.unbounded_send(evt);
|
||||
}
|
||||
}
|
||||
"initialize" => {
|
||||
is_ready.store(true, std::sync::atomic::Ordering::Relaxed);
|
||||
|
||||
Reference in new issue
Block a user