use ToString
This commit is contained in:
2 files changed
+3
-3
No files matched your search
@@ -121,7 +121,7 @@ impl DesktopContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// run (evaluate) a script in the WebView context
|
/// 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()));
|
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
|
/// 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
|
/// provided script is not valid JavaScript code or if it returns an uncaught
|
||||||
/// error.
|
/// error.
|
||||||
pub fn use_eval<S: std::fmt::Display>(cx: &ScopeState) -> impl Fn(S) + '_ {
|
pub fn use_eval<S: std::string::ToString>(cx: &ScopeState) -> impl Fn(S) + '_ {
|
||||||
let desktop = use_window(&cx);
|
let desktop = use_window(&cx);
|
||||||
|
|
||||||
move |script| desktop.eval(script)
|
move |script| desktop.eval(script)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ use dioxus_core::*;
|
|||||||
///
|
///
|
||||||
/// The closure will panic if the provided script is not valid JavaScript code
|
/// The closure will panic if the provided script is not valid JavaScript code
|
||||||
/// or if it returns an uncaught error.
|
/// or if it returns an uncaught error.
|
||||||
pub fn use_eval<S: std::fmt::Display>(_cx: &ScopeState) -> impl Fn(S) {
|
pub fn use_eval<S: std::string::ToString>(_cx: &ScopeState) -> impl Fn(S) {
|
||||||
|script| {
|
|script| {
|
||||||
js_sys::Function::new_no_args(&script.to_string())
|
js_sys::Function::new_no_args(&script.to_string())
|
||||||
.call0(&wasm_bindgen::JsValue::NULL)
|
.call0(&wasm_bindgen::JsValue::NULL)
|
||||||
|
|||||||
Reference in new issue
Block a user