You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tauri's initialization scripts may not have executed when the webview starts executing user scripts. This can cause Tauri API calls to fail unexpectedly. For example calling await listen(...) at a top level will fail if the __TAURI_INTERNALS__ object has not yet been populated.
Describe the solution you'd like
I would like to be able to check if Tauri has finished initializing and wait if it has not. I would suggest a new variable like window.__TAURI_READY__ or window.__TAURI_INTERNALS__.ready which would be set to true after all initialization scripts have finished executing. That could be wrapped in an function in the core library like:
Additionally, it would be nice to dispatch an event after the ready flag is set like window.dispatchEvent("tauriReady", new Event()) so that a script can wait for the ready condition without having to poll.
Describe the problem
Tauri's initialization scripts may not have executed when the webview starts executing user scripts. This can cause Tauri API calls to fail unexpectedly. For example calling
await listen(...)
at a top level will fail if the__TAURI_INTERNALS__
object has not yet been populated.Describe the solution you'd like
I would like to be able to check if Tauri has finished initializing and wait if it has not. I would suggest a new variable like
window.__TAURI_READY__
orwindow.__TAURI_INTERNALS__.ready
which would be set to true after all initialization scripts have finished executing. That could be wrapped in an function in the core library like:Additionally, it would be nice to dispatch an event after the ready flag is set like
window.dispatchEvent("tauriReady", new Event())
so that a script can wait for the ready condition without having to poll.Alternatives considered
No response
Additional context
See https://discord.com/channels/616186924390023171/1327342177608794113 for discussion.
The text was updated successfully, but these errors were encountered: