I used web-view,, want to show the small window with notice words in it, and automatically disappear after 2 seconds.
so create the handler and use it to exit the window, but how to create the handler?
web_view: 0.7.3
use web_view::*;
fn main() {
let html = "Hello world!";
let handle = web_view::Handle::current().unwrap();
std::thread::spawn(move || {
std::thread::sleep(std::time::Duration::from_secs(2));
handle.dispatch(move |webview| {
webview.terminate();
Ok(())
}).unwrap();
});
web_view::builder()
.title("")
.content(Content::Html(html))
.size(250, 20)
.resizable(false)
.frameless(true)
.user_data(handle.clone())
.invoke_handler(|_webview, _arg| Ok(()))
.run()
.unwrap();
}
how to create the handler?
let handle = web_view::Handle::current().unwrap(); # it's wrong way.
I used web-view,, want to show the small window with notice words in it, and automatically disappear after 2 seconds. so create the handler and use it to exit the window, but how to create the handler?
web_view: 0.7.3
how to create the handler? let handle = web_view::Handle::current().unwrap(); # it's wrong way.