We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9eb6107 commit 68ea653Copy full SHA for 68ea653
2 files changed
.changes/eval.md
@@ -0,0 +1,5 @@
1
+---
2
+"webview": patch
3
4
+
5
+Add eval method to WebviewMut
src/webview.rs
@@ -181,6 +181,14 @@ impl WebviewMut {
181
Ok(unsafe { sys::webview_get_window(*webview) as *mut Window })
182
}
183
184
185
+ pub fn eval(&mut self, js: &str) -> Result<(), Error> {
186
+ let webview = self.0.upgrade().ok_or(Error::WebviewNull)?;
187
+ let c_js = CString::new(js).expect("No null bytes in parameter js");
188
+ unsafe { sys::webview_eval(*webview, c_js.as_ptr()) }
189
+ Ok(())
190
+ }
191
192
pub fn dispatch<F>(&mut self, f: F) -> Result<(), Error>
193
where
194
F: FnOnce(&mut Webview) + Send + 'static,
0 commit comments