Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add tauriReady function to core #12586

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

alexmoon
Copy link
Contributor

Closes #12348.

Adds a tauriReady() function to @tauri-apps/api/core which returns a promise that resolves when all of Tauri's initialization scripts have finished.

This allows users to work around an issue observed on Windows where the webview is running the page's scripts before the initialization scripts have finished running, leading to errors when attempting to access Tauri APIs before they have been initialized.

I have observed cases where my page's scripts appear to be run between initialization scripts (i.e. some initialization scripts have run but others have not), so this adds a new initialization script to the end of the sequence to set the ready flag and dispatch the event to ensure that all other initialization scripts have finished running before the ready flag is set.

@alexmoon alexmoon requested a review from a team as a code owner January 31, 2025 20:14
Copy link
Contributor

github-actions bot commented Jan 31, 2025

Package Changes Through 29afa36

There are 7 changes which include tauri-cli with minor, tauri-runtime with minor, tauri-runtime-wry with minor, tauri-utils with minor, tauri with minor, @tauri-apps/api with minor, @tauri-apps/cli with minor

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
@tauri-apps/api 2.2.0 2.3.0
tauri-utils 2.1.1 2.2.0
tauri-bundler 2.2.3 2.2.4
tauri-runtime 2.3.0 2.4.0
tauri-runtime-wry 2.3.0 2.4.0
tauri-codegen 2.0.4 2.0.5
tauri-macros 2.0.4 2.0.5
tauri-plugin 2.0.4 2.0.5
tauri-build 2.0.5 2.0.6
tauri 2.2.5 2.3.0
@tauri-apps/cli 2.2.7 2.3.0
tauri-cli 2.2.7 2.3.0

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feat] Add way to check if Tauri's initialization scripts have run
1 participant