Merge pull request #1010 from Demonthos/fix-onload-event

Fix the onload event
This commit is contained in:
Jon Kelley authored and GitHub committed 2023-06-30 12:14:35 -07:00
commit abccc7463f
6 files changed
+15 -8

No files matched your search

+4 -3
View File
@@ -17,7 +17,7 @@ use js_sys::Array;
use rustc_hash::FxHashMap;
use std::{any::Any, rc::Rc, sync::Arc};
use wasm_bindgen::{closure::Closure, prelude::wasm_bindgen, JsCast, JsValue};
use web_sys::{console, Document, Element, Event};
use web_sys::{Document, Element, Event};
use crate::{file_engine::WebFileEngine, Config};
@@ -257,7 +257,6 @@ impl WebsysDom {
// We need tests that simulate clicks/etc and make sure every event type works.
pub fn virtual_event_from_websys_event(event: web_sys::Event, target: Element) -> Rc<dyn Any> {
use dioxus_html::events::*;
console::log_1(&event.clone().into());
match event.type_().as_str() {
"copy" | "cut" | "paste" => Rc::new(ClipboardData {}),
@@ -293,9 +292,11 @@ pub fn virtual_event_from_websys_event(event: web_sys::Event, target: Element) -
}
"transitionend" => Rc::new(TransitionData::from(event)),
"abort" | "canplay" | "canplaythrough" | "durationchange" | "emptied" | "encrypted"
| "ended" | "error" | "loadeddata" | "loadedmetadata" | "loadstart" | "pause" | "play"
| "ended" | "loadeddata" | "loadedmetadata" | "loadstart" | "pause" | "play"
| "playing" | "progress" | "ratechange" | "seeked" | "seeking" | "stalled" | "suspend"
| "timeupdate" | "volumechange" | "waiting" => Rc::new(MediaData {}),
"error" => Rc::new(ImageData { load_error: true }),
"load" => Rc::new(ImageData { load_error: false }),
"toggle" => Rc::new(ToggleData {}),
_ => Rc::new(()),