-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6e2bbe3
commit 1ec3b4e
Showing
8 changed files
with
109 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Runtime | ||
|
||
The Wails runtime is the standard library for Wails applications. It provides a number of features that may | ||
be used in your applications, including: | ||
|
||
- Window management | ||
- Dialogs | ||
- Browser integration | ||
- Clipboard | ||
- Frameless dragging | ||
- Tray icons | ||
- Menu management | ||
- System information | ||
- Events | ||
- Calling Go code | ||
- Context Menus | ||
- Screens | ||
- WML (Wails Markup Language) | ||
|
||
The runtime is required for integration between Go and the frontend. There are 2 ways to integrate the runtime: | ||
|
||
- Using the `@wailsio/runtime` package | ||
- Using a pre-built version of the runtime | ||
|
||
## Using the `@wailsio/runtime` package | ||
|
||
The `@wailsio/runtime` package is a JavaScript package that provides access to the Wails runtime. It is used in by all | ||
the standard templates and is the recommended way to integrate the runtime into your application. By using the package, | ||
you will only include the parts of the runtime that you use. | ||
|
||
The package is available on npm and can be installed using: | ||
|
||
```shell | ||
npm install --save @wailsio/runtime | ||
``` | ||
|
||
## Using a pre-built version of the runtime | ||
|
||
Some projects will not use a Javascript bundler and may prefer to use a pre-built version of the runtime. This is | ||
the default for the examples in `v3/examples`. The pre-built version of the runtime can be generated using the | ||
following command: | ||
|
||
```shell | ||
wails3 generate runtime | ||
``` | ||
|
||
This will generate a `runtime.js` (and `runtime.debug.js`) file in the `frontend` directory of your project. | ||
This file can be included in your assets directory and used in your application by adding it to your assets | ||
directory (normally `frontend/dist`) and then including it in your HTML: | ||
|
||
```html | ||
<html> | ||
<head> | ||
<script src="/runtime.js"></script> | ||
</head> | ||
<!--- ... --> | ||
</> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
" ",Mac,Windows,Linux | ||
Standard Executable," "," "," " | ||
macOS Application Bundle," ",:material-cancel:,:material-cancel: | ||
NSIS," "," "," " | ||
macOS DMG," ",:material-cancel:,:material-cancel: | ||
Standard Executable,:material-check-bold:,:material-check-bold:,:material-check-bold: | ||
macOS Application Bundle,:material-check-bold:,:material-cancel:,:material-cancel: | ||
NSIS,:material-cancel:,:material-check-bold:,:material-cancel: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package commands | ||
|
||
import ( | ||
"github.com/wailsapp/wails/v3/internal/commands/build_assets/runtime" | ||
"os" | ||
) | ||
|
||
type GenerateRuntimeOptions struct { | ||
} | ||
|
||
func GenerateRuntime(options *GenerateRuntimeOptions) error { | ||
err := os.WriteFile("runtime.js", runtime.RuntimeJS, 0644) | ||
if err != nil { | ||
return err | ||
} | ||
err = os.WriteFile("runtime.debug.js", runtime.RuntimeDebugJS, 0644) | ||
if err != nil { | ||
return err | ||
} | ||
return nil | ||
} |