Enable event propagation (#3062)

This commit is contained in:
daxpedda 2023-08-28 19:18:10 +02:00 committed by GitHub
parent 7541220a41
commit 1dfca5a395
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 75 additions and 176 deletions

View file

@ -35,14 +35,15 @@ pub struct PageTransitionEventHandle {
}
pub fn on_page_transition(
window: &web_sys::Window,
window: web_sys::Window,
show_handler: impl FnMut(PageTransitionEvent) + 'static,
hide_handler: impl FnMut(PageTransitionEvent) + 'static,
) -> PageTransitionEventHandle {
let show_closure = Closure::new(show_handler);
let hide_closure = Closure::new(hide_handler);
let show_listener = event_handle::EventListenerHandle::new(window, "pageshow", show_closure);
let show_listener =
event_handle::EventListenerHandle::new(window.clone(), "pageshow", show_closure);
let hide_listener = event_handle::EventListenerHandle::new(window, "pagehide", hide_closure);
PageTransitionEventHandle {
_show_listener: show_listener,