feat(core): create webview immediately when running in main thread (#3891)

This commit is contained in:
Lucas Fernandes Nogueira 2022-04-12 09:22:02 -07:00 committed by GitHub
parent 82c7855bf8
commit fa2baba76c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View File

@ -0,0 +1,5 @@
---
"tauri-runtime-wry": patch
---
Create webview immediately when executed in the main thread.

View File

@ -202,15 +202,16 @@ impl<T: UserEvent> Context<T> {
self.prepare_window(window_id);
self
.proxy
.send_event(Message::CreateWebview(
let context_ = context.clone();
send_user_message(
&context_,
Message::CreateWebview(
window_id,
Box::new(move |event_loop, web_context| {
create_webview(window_id, event_loop, web_context, context, pending)
}),
))
.map_err(|_| Error::FailedToSendMessage)?;
),
)?;
let dispatcher = WryDispatcher {
window_id,