Skip to content

Commit

Permalink
Provide a way to initialise the runtime if not using any runtime feat…
Browse files Browse the repository at this point in the history
…ures.
  • Loading branch information
leaanthony committed Dec 16, 2024
1 parent 4dd920d commit 19f6079
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion docs/src/content/docs/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 8 additions & 4 deletions v3/internal/runtime/desktop/@wailsio/runtime/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
});

Expand Down

0 comments on commit 19f6079

Please sign in to comment.