diff --git a/docs/src/content/docs/changelog.mdx b/docs/src/content/docs/changelog.mdx index 3c4470d13f5..09e1cbaaf0b 100644 --- a/docs/src/content/docs/changelog.mdx +++ b/docs/src/content/docs/changelog.mdx @@ -30,7 +30,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `app.OpenFileManager(path string, selectFile bool)` to open the system file manager to the path `path` with optional highlighting via `selectFile` by [@Krzysztofz01](https://github.com/Krzysztofz01) [@rcalixte](https://github.com/rcalixte) - New `-git` flag for `wails3 init` command by [@leaanthony](https://github.com/leaanthony) -- New `wails3 generate webview2bootstrapper` command by [@leaanthony](https://github.com/leaanthony)2 +- New `wails3 generate webview2bootstrapper` command by [@leaanthony](https://github.com/leaanthony) +- Added `init()` method in runtime to allow manual initialisation of the runtime by [@leaanthony](https://github.com/leaanthony) ### Fixed diff --git a/v3/internal/runtime/desktop/@wailsio/runtime/src/index.js b/v3/internal/runtime/desktop/@wailsio/runtime/src/index.js index 674d1ac1b79..071c60092e2 100644 --- a/v3/internal/runtime/desktop/@wailsio/runtime/src/index.js +++ b/v3/internal/runtime/desktop/@wailsio/runtime/src/index.js @@ -43,12 +43,16 @@ export { WML }; -var initialised = false; +let initialised = false; +export function init() { + window._wails.invoke = System.invoke; + System.invoke("wails:runtime:ready"); + initialised = true; +} + window.addEventListener("load", () => { if (!initialised) { - window._wails.invoke = System.invoke; - System.invoke("wails:runtime:ready"); - initialised = true; + init(); } });