diff --git a/packages/desktop/src/desktop_context.rs b/packages/desktop/src/desktop_context.rs index b15e26ea3..5a2d50f31 100644 --- a/packages/desktop/src/desktop_context.rs +++ b/packages/desktop/src/desktop_context.rs @@ -121,7 +121,7 @@ impl DesktopContext { } /// run (evaluate) a script in the WebView context - pub fn eval(&self, script: impl std::fmt::Display) { + pub fn eval(&self, script: impl std::string::ToString) { let _ = self.proxy.send_event(Eval(script.to_string())); } } @@ -206,7 +206,7 @@ pub(super) fn handler( /// The closure will cause the message processing thread to panic if the /// provided script is not valid JavaScript code or if it returns an uncaught /// error. -pub fn use_eval(cx: &ScopeState) -> impl Fn(S) + '_ { +pub fn use_eval(cx: &ScopeState) -> impl Fn(S) + '_ { let desktop = use_window(&cx); move |script| desktop.eval(script) diff --git a/packages/web/src/util.rs b/packages/web/src/util.rs index 696af7b21..3e8f92806 100644 --- a/packages/web/src/util.rs +++ b/packages/web/src/util.rs @@ -15,7 +15,7 @@ use dioxus_core::*; /// /// The closure will panic if the provided script is not valid JavaScript code /// or if it returns an uncaught error. -pub fn use_eval(_cx: &ScopeState) -> impl Fn(S) { +pub fn use_eval(_cx: &ScopeState) -> impl Fn(S) { |script| { js_sys::Function::new_no_args(&script.to_string()) .call0(&wasm_bindgen::JsValue::NULL)