Clean up a number of examples

This commit is contained in:
Jonathan Kelley committed 2024-01-15 13:06:05 -08:00
1 parent f2caa3a3ad
commit 6134a2ce24
30 files changed
+284 -413

No files matched your search

+14 -14
View File
@@ -2,6 +2,7 @@ use crate::{
assets::*, ipc::UserWindowEvent, shortcut::IntoAccelerator, window, DesktopContext,
ShortcutHandle, ShortcutRegistryError, WryEventHandler,
};
use dioxus_core::use_hook;
use tao::{event::Event, event_loop::EventLoopWindowTarget};
use wry::RequestAsyncResponder;
@@ -12,22 +13,21 @@ use wry::RequestAsyncResponder;
// .unwrap()
// }
// /// Get a closure that executes any JavaScript in the WebView context.
// pub fn use_wry_event_handler(
// ,
// handler: impl FnMut(&Event<UserWindowEvent>, &EventLoopWindowTarget<UserWindowEvent>) + 'static,
// ) -> &WryEventHandler {
// cx.use_hook(move || {
// let desktop = window();
/// Get a closure that executes any JavaScript in the WebView context.
pub fn use_wry_event_handler(
handler: impl FnMut(&Event<UserWindowEvent>, &EventLoopWindowTarget<UserWindowEvent>) + 'static,
) -> WryEventHandler {
use_hook(move || {
let desktop = window();
// let id = desktop.create_wry_event_handler(handler);
let id = desktop.create_wry_event_handler(handler);
// WryEventHandler {
// handlers: desktop.shared.event_handlers.clone(),
// id,
// }
// })
// }
WryEventHandler {
handlers: desktop.shared.event_handlers.clone(),
id,
}
})
}
// /// Provide a callback to handle asset loading yourself.
// ///