5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-03 00:09:56 +08:00

Documentation update + refactor

This commit is contained in:
Lea Anthony 2022-08-27 11:17:03 +10:00
parent 3632ef9dc8
commit 5a3af94772
No known key found for this signature in database
GPG Key ID: 33DAF7BB90A58405
9 changed files with 304 additions and 407 deletions

View File

@ -4,14 +4,26 @@ sidebar_position: 1
# Introduction # Introduction
## Overview
Wails is a project that enables you to write desktop apps using Go and web technologies. Wails is a project that enables you to write desktop apps using Go and web technologies.
Consider it a lightweight and fast Electron alternative for Go. You can easily build applications with the flexibility Consider it a lightweight and fast Electron alternative for Go. You can easily build applications with the flexibility
and power of Go, combined with a rich, modern frontend. and power of Go, combined with a rich, modern frontend.
Wails doesn't hold back with the eye candy either! This is [varly](https://varly.app) - a desktop application for ### Features
- Native Menus, Dialogs, Theming and Translucency
- Windows, macOS and linux support
- Built in templates for Svelte, React, Preact, Vue, Lit and Vanilla JS
- Easily call Go methods from Javascript
- Automatic Go struct to Typescript model generation
- No CGO or external DLLs required on Windows
- Live development mode using the power of [Vite](https://vite.net/)
- Powerful CLI to easily Create, Build and Package applications
- A rich [runtime library](/docs/next/reference/runtime)
- Applications built with Wails are Apple & Microsoft Store compliant
This is [varly](https://varly.app) - a desktop application for
MacOS & Windows written using Wails. Not only does it look great, it uses native menus and translucency - everything MacOS & Windows written using Wails. Not only does it look great, it uses native menus and translucency - everything
you'd expect from a modern native app. you'd expect from a modern native app.
@ -21,13 +33,13 @@ you'd expect from a modern native app.
</a> </a>
</p> </p>
## Quick Start Templates ### Quick Start Templates
Wails comes with a number of pre-configured templates that allow you to get your application up and running quickly. Wails comes with a number of pre-configured templates that allow you to get your application up and running quickly.
There are templates for the following frameworks: Svelte, React, Vue, Preact, Lit and Vanilla. There are both Javascript There are templates for the following frameworks: Svelte, React, Vue, Preact, Lit and Vanilla. There are both Javascript
and Typescript versions for each template. and Typescript versions for each template.
## Native Elements ### Native Elements
Wails uses a purpose built library for handling native elements such as Window, Menus, Dialogs, etc, so you can build Wails uses a purpose built library for handling native elements such as Window, Menus, Dialogs, etc, so you can build
good-looking, feature rich desktop applications. good-looking, feature rich desktop applications.
@ -35,43 +47,43 @@ good-looking, feature rich desktop applications.
**It does not embed a browser**, so it is resource efficient. Instead, it uses the native rendering engine for the **It does not embed a browser**, so it is resource efficient. Instead, it uses the native rendering engine for the
platform. On Windows, this is the new Microsoft Webview2 library, built on Chromium. platform. On Windows, this is the new Microsoft Webview2 library, built on Chromium.
## Go & Javascript Interoperability ### Go & Javascript Interoperability
Wails automatically makes your Go methods available to Javascript, so you can call them by name from your frontend! Wails automatically makes your Go methods available to Javascript, so you can call them by name from your frontend!
It even generates Typescript versions of the structs used by your Go methods, so you can pass the same data structures It even generates Typescript models for the structs used by your Go methods, so you can pass the same data structures
between Go and Javascript. between Go and Javascript.
## Runtime Library ### Runtime Library
Wails provides a runtime library, for both Go and Javascript, that handles a lot of the things modern applications need, Wails provides a runtime library, for both Go and Javascript, that handles a lot of the things modern applications need,
like Eventing, Logging, Dialogs, etc. like Eventing, Logging, Dialogs, etc.
## Live Development Experience ### Live Development Experience
### Automatic Rebuilds #### Automatic Rebuilds
When you run your application in "dev" mode, Wails will build your application as a native desktop application, but will When you run your application in "dev" mode, Wails will build your application as a native desktop application, but will
read your assets from disk. It will detect any changes to your Go code and automatically rebuild and relaunch your read your assets from disk. It will detect any changes to your Go code and automatically rebuild and relaunch your
application. application.
### Automatic Reloads #### Automatic Reloads
When changes to your application assets are detected, your running application will "reload", reflecting your changes When changes to your application assets are detected, your running application will "reload", reflecting your changes
almost immediately. almost immediately.
### Develop your application in a Browser #### Develop your application in a Browser
If you prefer to debug and develop in a browser then Wails has you covered. The running application also has a webserver If you prefer to debug and develop in a browser then Wails has you covered. The running application also has a webserver
that will run your application in any browser that connects to it. It will even refresh when your assets change on disk. that will run your application in any browser that connects to it. It will even refresh when your assets change on disk.
## Production-ready Native Binaries ### Production-ready Native Binaries
When you're ready to do the final build of your application, the CLI will compile it down to a single executable, with When you're ready to do the final build of your application, the CLI will compile it down to a single executable, with
all the assets bundled into it. On Windows and MacOS, it is possible to create a native package for distribution. The all the assets bundled into it. On Windows and MacOS, it is possible to create a native package for distribution. The
assets used in packaging (icon, info.plist, manifest file, etc) are part of your project and may be customised, giving assets used in packaging (icon, info.plist, manifest file, etc) are part of your project and may be customised, giving
you total control over how your applications are built. you total control over how your applications are built.
## Tooling ### Tooling
The Wails CLI provides a hassle-free way to generate, build and bundle your applications. It will do the heavy lifting The Wails CLI provides a hassle-free way to generate, build and bundle your applications. It will do the heavy lifting
of creating icons, compiling your application with optimal settings and delivering a distributable, production ready of creating icons, compiling your application with optimal settings and delivering a distributable, production ready

View File

@ -93,143 +93,109 @@ func main() {
### Title ### Title
Name: Title
Type: string
The text shown in the window's title bar. The text shown in the window's title bar.
Type: `string`
### Width ### Width
Name: Width
Type: int
The initial width of the window. The initial width of the window.
Type: `int`<br/>
Default: 1024. Default: 1024.
### Height ### Height
Name: Height
Type: int
The initial height of the window. The initial height of the window.
Type: `int`<br/>
Default: 768 Default: 768
### DisableResize ### DisableResize
Name: DisableResize
Type: bool
By default, the main window is resizable. Setting this to `true` will keep it a fixed size. By default, the main window is resizable. Setting this to `true` will keep it a fixed size.
Type: `bool`
### Fullscreen ### Fullscreen
Name: Fullscreen
Type: bool
Setting this to `true` will make the window fullscreen at startup. Setting this to `true` will make the window fullscreen at startup.
Type: `bool`
### Frameless ### Frameless
Name: Frameless
Type: bool
When set to `true`, the window will have no borders or title bar. When set to `true`, the window will have no borders or title bar.
Also see [Frameless Windows](../guides/frameless.mdx). Also see [Frameless Windows](../guides/frameless.mdx).
Type: `bool`
### MinWidth ### MinWidth
Name: MinWidth
Type: int
This sets the minimum width for the window. If the value given in `Width` is less than this value, This sets the minimum width for the window. If the value given in `Width` is less than this value,
the window will be set to `MinWidth` by default. the window will be set to `MinWidth` by default.
Type: `int`
### MinHeight ### MinHeight
Name: MinHeight
Type: int
This sets the minimum height for the window. If the value given in `Height` is less than this value, This sets the minimum height for the window. If the value given in `Height` is less than this value,
the window will be set to `MinHeight` by default. the window will be set to `MinHeight` by default.
Type: `int`
### MaxWidth ### MaxWidth
Name: MaxWidth
Type: int
This sets the maximum width for the window. If the value given in `Width` is more than this value, This sets the maximum width for the window. If the value given in `Width` is more than this value,
the window will be set to `MaxWidth` by default. the window will be set to `MaxWidth` by default.
Type: `int`
### MaxHeight ### MaxHeight
Name: MaxHeight
Type: int
This sets the maximum height for the window. If the value given in `Height` is more than this value, This sets the maximum height for the window. If the value given in `Height` is more than this value,
the window will be set to `MaxHeight` by default. the window will be set to `MaxHeight` by default.
Type: `int`
### StartHidden ### StartHidden
Name: StartHidden
Type: bool
When set to `true`, the application will be hidden until [WindowShow](../reference/runtime/window.mdx#windowshow) When set to `true`, the application will be hidden until [WindowShow](../reference/runtime/window.mdx#windowshow)
is called. is called.
Type: `bool`
### HideWindowOnClose ### HideWindowOnClose
Name: HideWindowOnClose
Type: bool
By default, closing the window will close the application. Setting this to `true` means closing the window will By default, closing the window will close the application. Setting this to `true` means closing the window will
hide the window instead. hide the window instead.
Type: `bool`
### BackgroundColour ### BackgroundColour
Name: BackgroundColour This value is the default background colour of the window.
Type: \*options.RGBA
Example: options.NewRGBA(255,0,0,128) - Red at 50% transparency Example: options.NewRGBA(255,0,0,128) - Red at 50% transparency
This value is the default background colour of the window. Type: `*options.RGBA`<br/>
Default: white Default: white
### AlwaysOnTop ### AlwaysOnTop
Name: AlwaysOnTop
Type: bool
Indicates that the window should stay above other windows when losing focus. Indicates that the window should stay above other windows when losing focus.
Type: `bool`
### Assets ### Assets
Name: Assets
Type: embed.FS
The frontend assets to be used by the application. Requires an `index.html` file. The frontend assets to be used by the application. Requires an `index.html` file.
Type: `embed.FS`
### AssetsHandler ### AssetsHandler
<img src="http://badges.github.io/stability-badges/dist/experimental.svg" /> <img src="http://badges.github.io/stability-badges/dist/experimental.svg" />
Name: AssetsHandler
Type: http.Handler
The assets handler is a generic `http.Handler` which will be called for any non GET request on the assets server The assets handler is a generic `http.Handler` which will be called for any non GET request on the assets server
and for GET requests which can not be served from the `assets` because the file is not found. and for GET requests which can not be served from the `assets` because the file is not found.
@ -254,79 +220,62 @@ supported by the introduction of WebKit2GTK 2.36.0+ support.
NOTE: When used in combination with a Frontend DevServer there might be limitations, eg. Vite serves the index.html NOTE: When used in combination with a Frontend DevServer there might be limitations, eg. Vite serves the index.html
on every path, that does not contain a file extension. on every path, that does not contain a file extension.
Type: `http.Handler`
### Menu ### Menu
Name: Menu
Type: \*menu.Menu
The menu to be used by the application. More details about Menus in the [Menu Reference](../reference/runtime/menu.mdx). The menu to be used by the application. More details about Menus in the [Menu Reference](../reference/runtime/menu.mdx).
NOTE: On Mac, if no menu is specified, a default menu will be created. :::note
On Mac, if no menu is specified, a default menu will be created.
:::
Type: `*menu.Menu`
### Logger ### Logger
Name: Logger
Type: logger.Logger
Default: Logger to Stdout
The logger to be used by the application. More details about logging in the [Log Reference](../reference/runtime/log.mdx). The logger to be used by the application. More details about logging in the [Log Reference](../reference/runtime/log.mdx).
Type: `logger.Logger`<br/>
Default: Logs to Stdout
### LogLevel ### LogLevel
Name: LogLevel
Type: logger.LogLevel
Default: `Info` in dev mode, `Error` in production mode
The default log level. More details about logging in the [Log Reference](../reference/runtime/log.mdx). The default log level. More details about logging in the [Log Reference](../reference/runtime/log.mdx).
Type: `logger.LogLevel`<br/>
Default: `Info` in dev mode, `Error` in production mode
### LogLevelProduction ### LogLevelProduction
Name: LogLevelProduction
Type: logger.LogLevel
Default: `Error`
The default log level for production builds. More details about logging in the [Log Reference](../reference/runtime/log.mdx). The default log level for production builds. More details about logging in the [Log Reference](../reference/runtime/log.mdx).
Type: `logger.LogLevel`<br/>
Default: `Error`
### OnStartup ### OnStartup
Name: OnStartup
Type: func(ctx context.Context)
This callback is called after the frontend has been created, but before `index.html` has been loaded. It is given This callback is called after the frontend has been created, but before `index.html` has been loaded. It is given
the application context. the application context.
Type: `func(ctx context.Context)`
### OnDomReady ### OnDomReady
Name: OnDomReady
Type: func(ctx context.Context)
This callback is called after the frontend has loaded `index.html` and its resources. It is given This callback is called after the frontend has loaded `index.html` and its resources. It is given
the application context. the application context.
Type: `func(ctx context.Context)`
### OnShutdown ### OnShutdown
Name: OnShutdown
Type: func(ctx context.Context)
This callback is called after the frontend has been destroyed, just before the application terminates. It is given This callback is called after the frontend has been destroyed, just before the application terminates. It is given
the application context. the application context.
Type: `func(ctx context.Context)`
### OnBeforeClose ### OnBeforeClose
Name: OnBeforeClose
Type: func(ctx context.Context) bool
If this callback is set, it will be called when the application is about to quit, either by clicking the window close If this callback is set, it will be called when the application is about to quit, either by clicking the window close
button or calling `runtime.Quit`. Returning true will cause the application to continue, false will continue shutdown button or calling `runtime.Quit`. Returning true will cause the application to continue, false will continue shutdown
as normal. This is good for confirming with the user that they wish to exit the program. as normal. This is good for confirming with the user that they wish to exit the program.
@ -336,9 +285,11 @@ Example:
```go title=windowsapp.go ```go title=windowsapp.go
func (b *App) beforeClose(ctx context.Context) (prevent bool) { func (b *App) beforeClose(ctx context.Context) (prevent bool) {
dialog, err := runtime.MessageDialog(ctx, runtime.MessageDialogOptions{ dialog, err := runtime.MessageDialog(ctx, runtime.MessageDialogOptions{
Type: runtime.QuestionDialog,
Title: "Quit?", Title: "Quit?",
Message: "Are you sure you want to quit?", Message: "Are you sure you want to quit?",
Type: ` runtime`.QuestionDialog,
}) })
if err != nil { if err != nil {
@ -348,12 +299,10 @@ func (b *App) beforeClose(ctx context.Context) (prevent bool) {
} }
``` ```
Type: `func(ctx context.Context) bool`
### WindowStartState ### WindowStartState
Name: WindowStartState
Type: options.WindowStartState
Defines how the window should present itself at startup. Defines how the window should present itself at startup.
| Value | Win | Mac | Lin | | Value | Win | Mac | Lin |
@ -362,91 +311,71 @@ Defines how the window should present itself at startup.
| Maximised | ✅ | ✅ | ✅ | | Maximised | ✅ | ✅ | ✅ |
| Minimised | ✅ | ❌ | ✅ | | Minimised | ✅ | ❌ | ✅ |
Type: `options.WindowStartState`
### Bind ### Bind
Name: Bind
Type: []interface{}
A slice of struct instances defining methods that need to be bound to the frontend. A slice of struct instances defining methods that need to be bound to the frontend.
Type: `[]interface{}`
### Windows ### Windows
Name: Windows
Type: \*windows.Options
This defines [Windows specific options](#windows-specific-options). This defines [Windows specific options](#windows-specific-options).
Type: `*windows.Options`
### Mac ### Mac
Name: Mac
Type: \*mac.Options
This defines [Mac specific options](#mac-specific-options). This defines [Mac specific options](#mac-specific-options).
Type: `*mac.Options`
### Linux ### Linux
Name: Linux
Type: \*linux.Options
This defines [Linux specific options](#linux-specific-options). This defines [Linux specific options](#linux-specific-options).
Type: `*linux.Options`
## Windows Specific Options ## Windows Specific Options
### WebviewIsTransparent ### WebviewIsTransparent
Name: WebviewIsTransparent
Type: bool
Setting this to `true` will make the webview background transparent when an alpha value of `0` is used. Setting this to `true` will make the webview background transparent when an alpha value of `0` is used.
This means that if you use `rgba(0,0,0,0)` for `background-color` in your CSS, the host window will show through. This means that if you use `rgba(0,0,0,0)` for `background-color` in your CSS, the host window will show through.
Often combined with [WindowIsTranslucent](#WindowIsTranslucent) to make frosty-looking applications. Often combined with [WindowIsTranslucent](#WindowIsTranslucent) to make frosty-looking applications.
Type: `bool`
### WindowIsTranslucent ### WindowIsTranslucent
Name: WindowIsTranslucent
Type: bool
Setting this to `true` will make the window background translucent. Often combined Setting this to `true` will make the window background translucent. Often combined
with [WebviewIsTransparent](#WebviewIsTransparent) to make frosty-looking applications. with [WebviewIsTransparent](#WebviewIsTransparent) to make frosty-looking applications.
Type: `bool`
### DisableWindowIcon ### DisableWindowIcon
Name: DisableWindowIcon
Type: bool
Setting this to `true` will remove the icon in the top left corner of the title bar. Setting this to `true` will remove the icon in the top left corner of the title bar.
Type: `bool`
### DisableFramelessWindowDecorations ### DisableFramelessWindowDecorations
Name: DisableFramelessWindowDecorations
Type: bool
Setting this to `true` will remove the window decorations in [Frameless](#Frameless) mode. This means there will be no Setting this to `true` will remove the window decorations in [Frameless](#Frameless) mode. This means there will be no
'Aero Shadow' and no 'Rounded Corners' shown for the window. Please note that 'Rounded Corners' are only supported on 'Aero Shadow' and no 'Rounded Corners' shown for the window. Please note that 'Rounded Corners' are only supported on
Windows 11. Windows 11.
Type: `bool`
### WebviewUserDataPath ### WebviewUserDataPath
Name: WebviewUserDataPath
Type: string
This defines the path where the WebView2 stores the user data. If empty `%APPDATA%\[BinaryName.exe]` will be used. This defines the path where the WebView2 stores the user data. If empty `%APPDATA%\[BinaryName.exe]` will be used.
Type: `string`
### WebviewBrowserPath ### WebviewBrowserPath
Name: WebviewBrowserPath
Type: string
This defines the path to a directory with WebView2 executable files and libraries. If empty, webview2 installed in the system will be used. This defines the path to a directory with WebView2 executable files and libraries. If empty, webview2 installed in the system will be used.
Important information about distribution of fixed version runtime: Important information about distribution of fixed version runtime:
@ -455,12 +384,10 @@ Important information about distribution of fixed version runtime:
- [Known issues for fixed version](https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution#known-issues-for-fixed-version) - [Known issues for fixed version](https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution#known-issues-for-fixed-version)
- [The path of fixed version of the WebView2 Runtime should not contain \Edge\Application\.](https://docs.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.1245.22#createcorewebview2environmentwithoptions) - [The path of fixed version of the WebView2 Runtime should not contain \Edge\Application\.](https://docs.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.1245.22#createcorewebview2environmentwithoptions)
Type: `string`
### Theme ### Theme
Name: Theme
Type: `windows.Theme`
Minimum Windows Version: Windows 10 2004/20H1 Minimum Windows Version: Windows 10 2004/20H1
This defines the theme that the application should use: This defines the theme that the application should use:
@ -471,18 +398,20 @@ This defines the theme that the application should use:
| Dark | The application will use a dark theme exclusively | | Dark | The application will use a dark theme exclusively |
| Light | The application will use a light theme exclusively | | Light | The application will use a light theme exclusively |
Type: `windows.Theme`
### CustomTheme ### CustomTheme
Name: CustomTheme :::note
Type: `windows.CustomTheme`
Minimum Windows Version: Windows 10/11 2009/21H2 Build 22000 Minimum Windows Version: Windows 10/11 2009/21H2 Build 22000
:::
Allows you to specify custom colours for TitleBar, TitleText and Border for both light and dark mode, as well as Allows you to specify custom colours for TitleBar, TitleText and Border for both light and dark mode, as well as
when the window is active or inactive. when the window is active or inactive.
#### CustomTheme Type: `windows.CustomTheme`
#### CustomTheme Type
The CustomTheme struct uses `int32` to specify the colour values. These are in the standard(!) Windows format of: The CustomTheme struct uses `int32` to specify the colour values. These are in the standard(!) Windows format of:
`0x00BBGGAA`. A helper function is provided to do RGB conversions into this format: `windows.RGB(r,g,b uint8)`. `0x00BBGGAA`. A helper function is provided to do RGB conversions into this format: `windows.RGB(r,g,b uint8)`.
@ -529,83 +458,68 @@ Example:
### Messages ### Messages
Name: Messages A struct of strings used by the webview2 installer if a valid webview2 runtime is not found.
Type: `*windows.Messages` Type: `*windows.Messages`
A struct of strings used by the webview2 installer if a valid webview2 runtime is not found.
Customise this for any language you choose to support. Customise this for any language you choose to support.
### ResizeDebounceMS ### ResizeDebounceMS
Name: ResizeDebounceMS
Type: uint16
ResizeDebounceMS is the amount of time to debounce redraws of webview2 when resizing the window. ResizeDebounceMS is the amount of time to debounce redraws of webview2 when resizing the window.
The default value (0) will perform redraws as fast as it can. The default value (0) will perform redraws as fast as it can.
Type: `uint16`
### OnSuspend ### OnSuspend
Name: OnSuspend
Type: func()
If set, this function will be called when windows initiates a switch to low power mode (suspend/hibernate) If set, this function will be called when windows initiates a switch to low power mode (suspend/hibernate)
Type: `func()`
### OnResume ### OnResume
Name: OnResume
Type: func()
If set, this function will be called when windows resumes from low power mode (suspend/hibernate) If set, this function will be called when windows resumes from low power mode (suspend/hibernate)
Type: `func()`
## Mac Specific Options ## Mac Specific Options
### TitleBar ### TitleBar
Name: TitleBar
Type: [\*mac.TitleBar](#titlebar-struct)
The TitleBar struct provides the ability to configure the look and feel of the title bar. The TitleBar struct provides the ability to configure the look and feel of the title bar.
Type: [`*mac.TitleBar`](#titlebar-struct)
### Appearance ### Appearance
Name: Appearance
Type: [AppearanceType](#appearance-type)
Appearance is used to set the style of your app in accordance with Apple's [NSAppearance](https://developer.apple.com/documentation/appkit/nsappearancename?language=objc) names. Appearance is used to set the style of your app in accordance with Apple's [NSAppearance](https://developer.apple.com/documentation/appkit/nsappearancename?language=objc) names.
Type: [`AppearanceType`](#appearance-type)
### WebviewIsTransparent ### WebviewIsTransparent
Name: WebviewIsTransparent
Type: bool
Setting this to `true` will make the webview background transparent when an alpha value of `0` is used. Setting this to `true` will make the webview background transparent when an alpha value of `0` is used.
This means that if you use `rgba(0,0,0,0)` for `background-color` in your CSS, the host window will show through. This means that if you use `rgba(0,0,0,0)` for `background-color` in your CSS, the host window will show through.
Often combined with [WindowIsTranslucent](#WindowIsTranslucent) to make frosty-looking applications. Often combined with [WindowIsTranslucent](#WindowIsTranslucent) to make frosty-looking applications.
Type: `bool`
### WindowIsTranslucent ### WindowIsTranslucent
Name: WindowIsTranslucent
Type: bool
Setting this to `true` will make the window background translucent. Often combined Setting this to `true` will make the window background translucent. Often combined
with [WebviewIsTransparent](#WebviewIsTransparent) to make frosty-looking applications. with [WebviewIsTransparent](#WebviewIsTransparent) to make frosty-looking applications.
Type: `bool`
### About ### About
Name: About
Type: [About](#about-struct)
This configuration lets you set the title, message and icon for the "About" menu item in the app menu created by the "AppMenu" role. This configuration lets you set the title, message and icon for the "About" menu item in the app menu created by the "AppMenu" role.
Type: [`About`](#about-struct)
#### Titlebar struct #### Titlebar struct
The titlebar of the application can be customised by using the TitleBar options: The titlebar of the application can be customised by using the TitleBar options:
@ -726,11 +640,10 @@ When clicked, that will open an about message box:
### Icon ### Icon
Name: Icon
Type: []byte
Sets up the icon representing the window. This icon is used when the window is minimized (also known as iconified). Sets up the icon representing the window. This icon is used when the window is minimized (also known as iconified).
Type: `[]byte`
Some window managers or desktop environments may also place it in the window frame, or display it in other contexts. Some window managers or desktop environments may also place it in the window frame, or display it in other contexts.
On others, the icon is not used at all, so your mileage may vary. On others, the icon is not used at all, so your mileage may vary.

View File

@ -4,14 +4,12 @@ sidebar_position: 7
# Browser # Browser
## Overview
These methods are related to the system browser. These methods are related to the system browser.
### BrowserOpenURL ### BrowserOpenURL
Go Signature: `BrowserOpenURL(ctx context.Context, url string)`
JS Signature: `BrowserOpenURL(url string)`
Opens the given URL in the system browser. Opens the given URL in the system browser.
Go: `BrowserOpenURL(ctx context.Context, url string)`<br/>
JS: `BrowserOpenURL(url string)`

View File

@ -4,8 +4,6 @@ sidebar_position: 5
# Dialog # Dialog
## Overview
This part of the runtime provides access to native dialogs, such as File Selectors and Message boxes. This part of the runtime provides access to native dialogs, such as File Selectors and Message boxes.
:::info Javascript :::info Javascript
@ -16,7 +14,7 @@ Dialog is currently unsupported in the JS runtime.
Opens a dialog that prompts the user to select a directory. Can be customised using [OpenDialogOptions](#opendialogoptions). Opens a dialog that prompts the user to select a directory. Can be customised using [OpenDialogOptions](#opendialogoptions).
Go Signature: `OpenDirectoryDialog(ctx context.Context, dialogOptions OpenDialogOptions) (string, error)` Go: `OpenDirectoryDialog(ctx context.Context, dialogOptions OpenDialogOptions) (string, error)`
Returns: Selected directory (blank if the user cancelled) or an error Returns: Selected directory (blank if the user cancelled) or an error
@ -24,7 +22,7 @@ Returns: Selected directory (blank if the user cancelled) or an error
Opens a dialog that prompts the user to select a file. Can be customised using [OpenDialogOptions](#opendialogoptions). Opens a dialog that prompts the user to select a file. Can be customised using [OpenDialogOptions](#opendialogoptions).
Go Signature: `OpenFileDialog(ctx context.Context, dialogOptions OpenDialogOptions) (string, error)` Go: `OpenFileDialog(ctx context.Context, dialogOptions OpenDialogOptions) (string, error)`
Returns: Selected file (blank if the user cancelled) or an error Returns: Selected file (blank if the user cancelled) or an error
@ -32,7 +30,7 @@ Returns: Selected file (blank if the user cancelled) or an error
Opens a dialog that prompts the user to select multiple files. Can be customised using [OpenDialogOptions](#opendialogoptions). Opens a dialog that prompts the user to select multiple files. Can be customised using [OpenDialogOptions](#opendialogoptions).
Go Signature: `OpenMultipleFilesDialog(ctx context.Context, dialogOptions OpenDialogOptions) ([]string, error)` Go: `OpenMultipleFilesDialog(ctx context.Context, dialogOptions OpenDialogOptions) ([]string, error)`
Returns: Selected files (nil if the user cancelled) or an error Returns: Selected files (nil if the user cancelled) or an error
@ -40,7 +38,7 @@ Returns: Selected files (nil if the user cancelled) or an error
Opens a dialog that prompts the user to select a filename for the purposes of saving. Can be customised using [SaveDialogOptions](#savedialogoptions). Opens a dialog that prompts the user to select a filename for the purposes of saving. Can be customised using [SaveDialogOptions](#savedialogoptions).
Go Signature: `SaveFileDialog(ctx context.Context, dialogOptions SaveDialogOptions) (string, error)` Go: `SaveFileDialog(ctx context.Context, dialogOptions SaveDialogOptions) (string, error)`
Returns: The selected file (blank if the user cancelled) or an error Returns: The selected file (blank if the user cancelled) or an error
@ -48,7 +46,7 @@ Returns: The selected file (blank if the user cancelled) or an error
Displays a message using a message dialog. Can be customised using [MessageDialogOptions](#messagedialogoptions). Displays a message using a message dialog. Can be customised using [MessageDialogOptions](#messagedialogoptions).
Go Signature: `MessageDialog(ctx context.Context, dialogOptions MessageDialogOptions) (string, error)` Go: `MessageDialog(ctx context.Context, dialogOptions MessageDialogOptions) (string, error)`
Returns: The text of the selected button or an error Returns: The text of the selected button or an error

View File

@ -4,48 +4,42 @@ sidebar_position: 2
# Events # Events
## Overview
The Wails runtime provides a unified events system, where events can be emitted or received by either Go or Javascript. The Wails runtime provides a unified events system, where events can be emitted or received by either Go or Javascript.
Optionally, data may be passed with the events. Listeners will receive the data in the local data types. Optionally, data may be passed with the events. Listeners will receive the data in the local data types.
### EventsOn ### EventsOn
Go Signature: `EventsOn(ctx context.Context, eventName string, callback func(optionalData ...interface{}))`
JS Signature: `EventsOn(eventName string, callback function(optionalData?: any))`
This method sets up a listener for the given event name. When an event of type `eventName` is [emitted](#EventsEmit), This method sets up a listener for the given event name. When an event of type `eventName` is [emitted](#EventsEmit),
the callback is triggered. Any additional data sent with the emitted event will be passed to the callback. the callback is triggered. Any additional data sent with the emitted event will be passed to the callback.
Go: `EventsOn(ctx context.Context, eventName string, callback func(optionalData ...interface{}))`<br/>
JS: `EventsOn(eventName string, callback function(optionalData?: any))`
### EventsOff ### EventsOff
Go Signature: `EventsOff(ctx context.Context, eventName string)`
JS Signature: `EventsOff(eventName string)`
This method unregisters the listener for the given event name. This method unregisters the listener for the given event name.
Go: `EventsOff(ctx context.Context, eventName string)`<br/>
JS: `EventsOff(eventName string)`
### EventsOnce ### EventsOnce
Go Signature: `EventsOnce(ctx context.Context, eventName string, callback func(optionalData ...interface{}))`
JS Signature: `EventsOnce(eventName string, callback function(optionalData?: any))`
This method sets up a listener for the given event name, but will only trigger once. This method sets up a listener for the given event name, but will only trigger once.
Go: `EventsOnce(ctx context.Context, eventName string, callback func(optionalData ...interface{}))`<br/>
JS: `EventsOnce(eventName string, callback function(optionalData?: any))`
### EventsOnMultiple ### EventsOnMultiple
Go Signature: `EventsOnMultiple(ctx context.Context, eventName string, callback func(optionalData ...interface{}), counter int)`
JS Signature: `EventsOnMultiple(eventName string, callback function(optionalData?: any), counter int)`
This method sets up a listener for the given event name, but will only trigger a maximum of `counter` times. This method sets up a listener for the given event name, but will only trigger a maximum of `counter` times.
Go: `EventsOnMultiple(ctx context.Context, eventName string, callback func(optionalData ...interface{}), counter int)`<br/>
JS: `EventsOnMultiple(eventName string, callback function(optionalData?: any), counter int)`
### EventsEmit ### EventsEmit
Go Signature: `EventsEmit(ctx context.Context, eventName string, optionalData ...interface{})`
JS Signature: `EventsEmit(ctx context, optionalData function(optionalData?: any))`
This method emits the given event. Optional data may be passed with the event. This will trigger any event listeners. This method emits the given event. Optional data may be passed with the event. This will trigger any event listeners.
Go: `EventsEmit(ctx context.Context, eventName string, optionalData ...interface{})`<br/>
JS: `EventsEmit(ctx context, optionalData function(optionalData?: any))`

View File

@ -7,6 +7,15 @@ sidebar_position: 1
The runtime is a library that provides utility methods for your application. There is both a Go and Javascript runtime The runtime is a library that provides utility methods for your application. There is both a Go and Javascript runtime
and the aim is to try and keep them at parity where possible. and the aim is to try and keep them at parity where possible.
It has utility methods for:
- [Window](window.mdx)
- [Menu](menu.mdx)
- [Dialog](dialog.mdx)
- [Events](events.mdx)
- [Browser](browser.mdx)
- [Log](log.mdx)
The Go Runtime is available through importing `github.com/wailsapp/wails/v2/pkg/runtime`. All methods in this package The Go Runtime is available through importing `github.com/wailsapp/wails/v2/pkg/runtime`. All methods in this package
take a context as the first parameter. This context should be obtained from the [OnStartup](../options.mdx#onstartup) take a context as the first parameter. This context should be obtained from the [OnStartup](../options.mdx#onstartup)
or [OnDomReady](../options.mdx#ondomready) hooks. or [OnDomReady](../options.mdx#ondomready) hooks.
@ -26,7 +35,8 @@ frontend directory.
### Hide ### Hide
Go Signature: `Hide(ctx context.Context)` Go: `Hide(ctx context.Context)`<br/>
JS: `Hide()`
Hides the application. Hides the application.
@ -38,8 +48,6 @@ For Windows and Linux, this is currently the same as `WindowHide`.
### Show ### Show
Go Signature: `Show(ctx context.Context)`
Shows the application. Shows the application.
:::info Note :::info Note
@ -47,22 +55,38 @@ On Mac, this will bring the application back into the foreground.
For Windows and Linux, this is currently the same as `WindowShow`. For Windows and Linux, this is currently the same as `WindowShow`.
::: :::
### Quit Go: `Show(ctx context.Context)`<br/>
JS: `Show()`
Go Signature: `Quit(ctx context.Context)` ### Quit
Quits the application. Quits the application.
### Environment Go: `Quit(ctx context.Context)`<br/>
JS: `Quit()`
Go Signature: `Environment(ctx context.Context) EnvironmentInfo` ### Environment
Returns details of the current environment. Returns details of the current environment.
Go: `Environment(ctx context.Context) EnvironmentInfo`<br/>
JS: `Environment(): Promise<EnvironmentInfo>`
#### EnvironmentInfo #### EnvironmentInfo
Go:
```go ```go
type EnvironmentInfo struct { type EnvironmentInfo struct {
BuildType string // Either "production", "debug" or "dev" BuildType string
Platform string
Arch string
}
```
JS:
```ts
interface EnvironmentInfo {
buildType: string;
platform: string;
arch: string;
} }
``` ```

View File

@ -4,8 +4,6 @@ sidebar_position: 3
# Log # Log
## Overview
The Wails runtime provides a logging mechanism that may be called from Go or Javascript. Like most The Wails runtime provides a logging mechanism that may be called from Go or Javascript. Like most
loggers, there are a number of log levels: loggers, there are a number of log levels:
@ -21,108 +19,97 @@ level will output all messages except `Trace` messages.
### LogPrint ### LogPrint
Go Signature: `LogPrint(ctx context.Context, message string)`
JS Signature: `LogPrint(message: string)`
Logs the given message as a raw message. Logs the given message as a raw message.
Go: `LogPrint(ctx context.Context, message string)`<br/>
JS: `LogPrint(message: string)`
### LogPrintf ### LogPrintf
Go Signature: `LogPrintf(ctx context.Context, format string, args ...interface{})`
Logs the given message as a raw message. Logs the given message as a raw message.
Go: `LogPrintf(ctx context.Context, format string, args ...interface{})`<br/>
### LogTrace ### LogTrace
Go Signature: `LogTrace(ctx context.Context, message string)`
JS Signature: `LogTrace(message: string)`
Logs the given message at the `Trace` log level. Logs the given message at the `Trace` log level.
Go: `LogTrace(ctx context.Context, message string)`<br/>
JS: `LogTrace(message: string)`
### LogTracef ### LogTracef
Go Signature: `LogTracef(ctx context.Context, format string, args ...interface{})`
Logs the given message at the `Trace` log level. Logs the given message at the `Trace` log level.
Go: `LogTracef(ctx context.Context, format string, args ...interface{})`<br/>
### LogDebug ### LogDebug
Go Signature: `LogDebug(ctx context.Context, message string)`
JS Signature: `LogDebug(message: string)`
Logs the given message at the `Debug` log level. Logs the given message at the `Debug` log level.
Go: `LogDebug(ctx context.Context, message string)`<br/>
JS: `LogDebug(message: string)`
### LogDebugf ### LogDebugf
Go Signature: `LogDebugf(ctx context.Context, format string, args ...interface{})`
Logs the given message at the `Debug` log level. Logs the given message at the `Debug` log level.
Go: `LogDebugf(ctx context.Context, format string, args ...interface{})`<br/>
### LogInfo ### LogInfo
Go Signature: `LogInfo(ctx context.Context, message string)`
JS Signature: `LogInfo(message: string)`
Logs the given message at the `Info` log level. Logs the given message at the `Info` log level.
Go: `LogInfo(ctx context.Context, message string)`<br/>
JS: `LogInfo(message: string)`
### LogInfof ### LogInfof
Go Signature: `LogInfof(ctx context.Context, format string, args ...interface{})`
Logs the given message at the `Info` log level. Logs the given message at the `Info` log level.
Go: `LogInfof(ctx context.Context, format string, args ...interface{})`<br/>
### LogWarning ### LogWarning
Go Signature: `LogWarning(ctx context.Context, message string)`
JS Signature: `LogWarning(message: string)`
Logs the given message at the `Warning` log level. Logs the given message at the `Warning` log level.
Go: `LogWarning(ctx context.Context, message string)`<br/>
JS: `LogWarning(message: string)`
### LogWarningf ### LogWarningf
Go Signature: `LogWarningf(ctx context.Context, format string, args ...interface{})`
Logs the given message at the `Warning` log level. Logs the given message at the `Warning` log level.
Go: `LogWarningf(ctx context.Context, format string, args ...interface{})`<br/>
### LogError ### LogError
Go Signature: `LogError(ctx context.Context, message string)`
JS Signature: `LogError(message: string)`
Logs the given message at the `Error` log level. Logs the given message at the `Error` log level.
Go: `LogError(ctx context.Context, message string)`<br/>
JS: `LogError(message: string)`
### LogErrorf ### LogErrorf
Go Signature: `LogErrorf(ctx context.Context, format string, args ...interface{})`
Logs the given message at the `Error` log level. Logs the given message at the `Error` log level.
Go: `LogErrorf(ctx context.Context, format string, args ...interface{})`<br/>
### LogFatal ### LogFatal
Go Signature: `LogFatal(ctx context.Context, message string)`
JS Signature: `LogFatal(message: string)`
Logs the given message at the `Fatal` log level. Logs the given message at the `Fatal` log level.
Go: `LogFatal(ctx context.Context, message string)`<br/>
JS: `LogFatal(message: string)`
### LogFatalf ### LogFatalf
Go Signature: `LogFatalf(ctx context.Context, format string, args ...interface{})`
Logs the given message at the `Fatal` log level. Logs the given message at the `Fatal` log level.
Go: `LogFatalf(ctx context.Context, format string, args ...interface{})`<br/>
### LogSetLogLevel ### LogSetLogLevel
Go Signature: `LogSetLogLevel(ctx context.Context, level logger.LogLevel)`
JS Signature: `LogSetLogLevel(level: number)`
Sets the log level. In Javascript, the number relates to the following log levels: Sets the log level. In Javascript, the number relates to the following log levels:
| Value | Log Level | | Value | Log Level |
@ -133,6 +120,9 @@ Sets the log level. In Javascript, the number relates to the following log level
| 4 | Warning | | 4 | Warning |
| 5 | Error | | 5 | Error |
Go: `LogSetLogLevel(ctx context.Context, level logger.LogLevel)`<br/>
JS: `LogSetLogLevel(level: number)`
## Using a Custom Logger ## Using a Custom Logger
A custom logger may be used by providing it using the [Logger](../options.mdx#logger) A custom logger may be used by providing it using the [Logger](../options.mdx#logger)

View File

@ -4,8 +4,6 @@ sidebar_position: 6
# Menu # Menu
## Overview
These methods are related to the application menu. These methods are related to the application menu.
:::info Javascript :::info Javascript
@ -14,12 +12,12 @@ Menu is currently unsupported in the JS runtime.
### MenuSetApplicationMenu ### MenuSetApplicationMenu
Go Signature: `MenuSetApplicationMenu(ctx context.Context, menu *menu.Menu)` Sets the application menu to the given [menu](../menus.mdx).
Sets the application menu to the given [menu](../menus.mdx) . Go: `MenuSetApplicationMenu(ctx context.Context, menu *menu.Menu)`
### MenuUpdateApplicationMenu ### MenuUpdateApplicationMenu
Go Signature: `MenuUpdateApplicationMenu(ctx context.Context)`
Updates the application menu, picking up any changes to the menu passed to `MenuSetApplicationMenu`. Updates the application menu, picking up any changes to the menu passed to `MenuSetApplicationMenu`.
Go: `MenuUpdateApplicationMenu(ctx context.Context)`

View File

@ -4,226 +4,196 @@ sidebar_position: 4
# Window # Window
## Overview
These methods give control of the application window. These methods give control of the application window.
### WindowSetTitle ### WindowSetTitle
Go Signature: `WindowSetTitle(ctx context.Context, title string)`
JS Signature: `WindowSetTitle(title: string)`
Sets the text in the window title bar. Sets the text in the window title bar.
Go: `WindowSetTitle(ctx context.Context, title string)`<br/>
JS: `WindowSetTitle(title: string)`
### WindowFullscreen ### WindowFullscreen
Go Signature: `WindowFullscreen(ctx context.Context)`
JS Signature: `WindowFullscreen()`
Makes the window full screen. Makes the window full screen.
Go: `WindowFullscreen(ctx context.Context)`<br/>
JS: `WindowFullscreen()`
### WindowUnfullscreen ### WindowUnfullscreen
Go Signature: `WindowUnfullscreen(ctx context.Context)`
JS Signature: `WindowUnfullscreen()`
Restores the previous window dimensions and position prior to full screen. Restores the previous window dimensions and position prior to full screen.
Go: `WindowUnfullscreen(ctx context.Context)`<br/>
JS: `WindowUnfullscreen()`
### WindowCenter ### WindowCenter
Go Signature: `WindowCenter(ctx context.Context)`
JS Signature: `WindowCenter()`
Centers the window on the monitor the window is currently on. Centers the window on the monitor the window is currently on.
Go: `WindowCenter(ctx context.Context)`<br/>
JS: `WindowCenter()`
### WindowReload ### WindowReload
Go Signature: `WindowReload(ctx context.Context)`
JS Signature: `WindowReload()`
Performs a "reload" (Reloads current page). Performs a "reload" (Reloads current page).
Go: `WindowReload(ctx context.Context)`<br/>
JS: `WindowReload()`
### WindowReloadApp ### WindowReloadApp
Go Signature: `WindowReloadApp(ctx context.Context)`
JS Signature: `WindowReloadApp()`
Reloads the application frontend. Reloads the application frontend.
### WindowSetSy Go: `WindowReloadApp(ctx context.Context)`<br/>
JS: `WindowReloadApp()`
### WindowSetSystemDefaultTheme ### WindowSetSystemDefaultTheme
Go Signature: `WindowSetSystemDefaultTheme(ctx context.Context)`
JS Signature: `WindowSetSystemDefaultTheme()`
Windows only. Windows only.
Go: `WindowSetSystemDefaultTheme(ctx context.Context)`<br/>
JS: `WindowSetSystemDefaultTheme()`
Sets window theme to system default (dark/light). Sets window theme to system default (dark/light).
### WindowSetLightTheme ### WindowSetLightTheme
Go Signature: `WindowSetLightTheme(ctx context.Context)`
JS Signature: `WindowSetLightTheme()`
Windows only. Windows only.
Go: `WindowSetLightTheme(ctx context.Context)`<br/>
JS: `WindowSetLightTheme()`
Sets window theme to light. Sets window theme to light.
### WindowSetDarkTheme ### WindowSetDarkTheme
Go Signature: `WindowSetDarkTheme(ctx context.Context)`
JS Signature: `WindowSetDarkTheme()`
Windows only. Windows only.
Go: `WindowSetDarkTheme(ctx context.Context)`<br/>
JS: `WindowSetDarkTheme()`
Sets window theme to dark. Sets window theme to dark.
### WindowShow ### WindowShow
Go Signature: `WindowShow(ctx context.Context)`
JS Signature: `WindowShow()`
Shows the window, if it is currently hidden. Shows the window, if it is currently hidden.
Go: `WindowShow(ctx context.Context)`<br/>
JS: `WindowShow()`
### WindowHide ### WindowHide
Go Signature: `WindowHide(ctx context.Context)`
JS Signature: `WindowHide()`
Hides the window, if it is currently visible. Hides the window, if it is currently visible.
Go: `WindowHide(ctx context.Context)`<br/>
JS: `WindowHide()`
### WindowSetSize ### WindowSetSize
Go Signature: `WindowSetSize(ctx context.Context, width int, height int)`
JS Signature: `WindowSetSize(size: Size)`
Sets the width and height of the window. Sets the width and height of the window.
Go: `WindowSetSize(ctx context.Context, width int, height int)`<br/>
JS: `WindowSetSize(size: Size)`
### WindowGetSize ### WindowGetSize
Go Signature: `WindowGetSize(ctx context.Context) (width int, height int)`
JS Signature: `WindowGetSize() : Size`
Gets the width and height of the window. Gets the width and height of the window.
Go: `WindowGetSize(ctx context.Context) (width int, height int)`<br/>
JS: `WindowGetSize() : Size`
### WindowSetMinSize ### WindowSetMinSize
Go Signature: `WindowSetMinSize(ctx context.Context, width int, height int)`
JS Signature: `WindowSetMinSize(size: Size)`
Sets the minimum window size. Sets the minimum window size.
Will resize the window if the window is currently smaller than the given dimensions. Will resize the window if the window is currently smaller than the given dimensions.
Setting a size of `0,0` will disable this constraint. Setting a size of `0,0` will disable this constraint.
Go: `WindowSetMinSize(ctx context.Context, width int, height int)`<br/>
JS: `WindowSetMinSize(size: Size)`
### WindowSetMaxSize ### WindowSetMaxSize
Go Signature: `WindowSetMaxSize(ctx context.Context, width int, height int)`
JS Signature: `WindowSetMaxSize(size: Size)`
Sets the maximum window size. Sets the maximum window size.
Will resize the window if the window is currently larger than the given dimensions. Will resize the window if the window is currently larger than the given dimensions.
Setting a size of `0,0` will disable this constraint. Setting a size of `0,0` will disable this constraint.
Go: `WindowSetMaxSize(ctx context.Context, width int, height int)`<br/>
JS: `WindowSetMaxSize(size: Size)`
### WindowSetAlwaysOnTop ### WindowSetAlwaysOnTop
Go Signature: `WindowSetAlwaysOnTop(ctx context.Context, b bool)`
JS Signature: `WindowSetAlwaysOnTop(b: Boolen)`
Sets the window AlwaysOnTop or not on top. Sets the window AlwaysOnTop or not on top.
Go: `WindowSetAlwaysOnTop(ctx context.Context, b bool)`<br/>
JS: `WindowSetAlwaysOnTop(b: Boolen)`
### WindowSetPosition ### WindowSetPosition
Go Signature: `WindowSetPosition(ctx context.Context, x int, y int)`
JS Signature: `WindowSetPosition(position: Position)`
Sets the window position relative to the monitor the window is currently on. Sets the window position relative to the monitor the window is currently on.
Go: `WindowSetPosition(ctx context.Context, x int, y int)`<br/>
JS: `WindowSetPosition(position: Position)`
### WindowGetPosition ### WindowGetPosition
Go Signature: `WindowGetPosition(ctx context.Context) (x int, y int)`
JS Signature: `WindowGetPosition() : Position`
Gets the window position relative to the monitor the window is currently on. Gets the window position relative to the monitor the window is currently on.
Go: `WindowGetPosition(ctx context.Context) (x int, y int)`<br/>
JS: `WindowGetPosition() : Position`
### WindowMaximise ### WindowMaximise
Go Signature: `WindowMaximise(ctx context.Context)`
JS Signature: `WindowMaximise()`
Maximises the window to fill the screen. Maximises the window to fill the screen.
Go: `WindowMaximise(ctx context.Context)`<br/>
JS: `WindowMaximise()`
### WindowUnmaximise ### WindowUnmaximise
Go Signature: `WindowUnmaximise(ctx context.Context)`
JS Signature: `WindowUnmaximise()`
Restores the window to the dimensions and position prior to maximising. Restores the window to the dimensions and position prior to maximising.
Go: `WindowUnmaximise(ctx context.Context)`<br/>
JS: `WindowUnmaximise()`
### WindowToggleMaximise ### WindowToggleMaximise
Go Signature: `WindowToggleMaximise(ctx context.Context)`
JS Signature: `WindowToggleMaximise()`
Toggles between Maximised and UnMaximised. Toggles between Maximised and UnMaximised.
Go: `WindowToggleMaximise(ctx context.Context)`<br/>
JS: `WindowToggleMaximise()`
### WindowMinimise ### WindowMinimise
Go Signature: `WindowMinimise(ctx context.Context)`
JS Signature: `WindowMinimise()`
Minimises the window. Minimises the window.
Go: `WindowMinimise(ctx context.Context)`<br/>
JS: `WindowMinimise()`
### WindowUnminimise ### WindowUnminimise
Go Signature: `WindowUnminimise(ctx context.Context)`
JS Signature: `WindowUnminimise()`
Restores the window to the dimensions and position prior to minimising. Restores the window to the dimensions and position prior to minimising.
Go: `WindowUnminimise(ctx context.Context)`<br/>
JS: `WindowUnminimise()`
### WindowSetBackgroundColour ### WindowSetBackgroundColour
Go Signature: `WindowSetBackgroundColour(ctx context.Context, R, G, B, A uint8)`
JS Signature: `WindowSetBackgroundColour(R, G, B, A)`
Sets the background colour of the window to the given RGBA colour definition. Sets the background colour of the window to the given RGBA colour definition.
This colour will show through for all transparent pixels. This colour will show through for all transparent pixels.
Valid values for R, G, B and A are 0-255. Valid values for R, G, B and A are 0-255.
:::info Windows :::info Windows
On Windows, only alpha values of 0 or 255 are supported. On Windows, only alpha values of 0 or 255 are supported.
Any value that is not 0 will be considered 255. Any value that is not 0 will be considered 255.
::: :::
Go: `WindowSetBackgroundColour(ctx context.Context, R, G, B, A uint8)`<br/>
JS: `WindowSetBackgroundColour(R, G, B, A)`
## Typescript Object Definitions ## Typescript Object Definitions
### Position ### Position