mirror of
https://github.com/wavetermdev/wails.git
synced 2026-08-05 13:53:43 -07:00
Documentation update + refactor
This commit is contained in:
@@ -4,14 +4,26 @@ sidebar_position: 1
|
||||
|
||||
# Introduction
|
||||
|
||||
## Overview
|
||||
|
||||
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
|
||||
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
|
||||
you'd expect from a modern native app.
|
||||
|
||||
@@ -21,13 +33,13 @@ you'd expect from a modern native app.
|
||||
</a>
|
||||
</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.
|
||||
There are templates for the following frameworks: Svelte, React, Vue, Preact, Lit and Vanilla. There are both Javascript
|
||||
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
|
||||
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
|
||||
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!
|
||||
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.
|
||||
|
||||
## Runtime Library
|
||||
### Runtime Library
|
||||
|
||||
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.
|
||||
|
||||
## 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
|
||||
read your assets from disk. It will detect any changes to your Go code and automatically rebuild and relaunch your
|
||||
application.
|
||||
|
||||
### Automatic Reloads
|
||||
#### Automatic Reloads
|
||||
|
||||
When changes to your application assets are detected, your running application will "reload", reflecting your changes
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
of creating icons, compiling your application with optimal settings and delivering a distributable, production ready
|
||||
|
||||
+108
-195
File diff suppressed because it is too large
Load Diff
@@ -4,14 +4,12 @@ sidebar_position: 7
|
||||
|
||||
# Browser
|
||||
|
||||
## Overview
|
||||
|
||||
These methods are related to the system browser.
|
||||
|
||||
### BrowserOpenURL
|
||||
|
||||
Go Signature: `BrowserOpenURL(ctx context.Context, url string)`
|
||||
|
||||
JS Signature: `BrowserOpenURL(url string)`
|
||||
|
||||
Opens the given URL in the system browser.
|
||||
|
||||
Go: `BrowserOpenURL(ctx context.Context, url string)`<br/>
|
||||
JS: `BrowserOpenURL(url string)`
|
||||
|
||||
|
||||
@@ -4,8 +4,6 @@ sidebar_position: 5
|
||||
|
||||
# Dialog
|
||||
|
||||
## Overview
|
||||
|
||||
This part of the runtime provides access to native dialogs, such as File Selectors and Message boxes.
|
||||
|
||||
:::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).
|
||||
|
||||
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
|
||||
|
||||
@@ -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).
|
||||
|
||||
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
|
||||
|
||||
@@ -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).
|
||||
|
||||
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
|
||||
|
||||
@@ -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).
|
||||
|
||||
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
|
||||
|
||||
@@ -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).
|
||||
|
||||
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
|
||||
|
||||
|
||||
@@ -4,48 +4,42 @@ sidebar_position: 2
|
||||
|
||||
# Events
|
||||
|
||||
## Overview
|
||||
|
||||
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.
|
||||
|
||||
### 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),
|
||||
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
|
||||
|
||||
Go Signature: `EventsOff(ctx context.Context, eventName string)`
|
||||
|
||||
JS Signature: `EventsOff(eventName string)`
|
||||
|
||||
This method unregisters the listener for the given event name.
|
||||
|
||||
Go: `EventsOff(ctx context.Context, eventName string)`<br/>
|
||||
JS: `EventsOff(eventName string)`
|
||||
|
||||
### 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.
|
||||
|
||||
Go: `EventsOnce(ctx context.Context, eventName string, callback func(optionalData ...interface{}))`<br/>
|
||||
JS: `EventsOnce(eventName string, callback function(optionalData?: any))`
|
||||
|
||||
### 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.
|
||||
|
||||
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
|
||||
|
||||
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.
|
||||
|
||||
Go: `EventsEmit(ctx context.Context, eventName string, optionalData ...interface{})`<br/>
|
||||
JS: `EventsEmit(ctx context, optionalData function(optionalData?: any))`
|
||||
|
||||
|
||||
@@ -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
|
||||
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
|
||||
take a context as the first parameter. This context should be obtained from the [OnStartup](../options.mdx#onstartup)
|
||||
or [OnDomReady](../options.mdx#ondomready) hooks.
|
||||
@@ -26,7 +35,8 @@ frontend directory.
|
||||
|
||||
### Hide
|
||||
|
||||
Go Signature: `Hide(ctx context.Context)`
|
||||
Go: `Hide(ctx context.Context)`<br/>
|
||||
JS: `Hide()`
|
||||
|
||||
Hides the application.
|
||||
|
||||
@@ -38,8 +48,6 @@ For Windows and Linux, this is currently the same as `WindowHide`.
|
||||
|
||||
### Show
|
||||
|
||||
Go Signature: `Show(ctx context.Context)`
|
||||
|
||||
Shows the application.
|
||||
|
||||
:::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`.
|
||||
:::
|
||||
|
||||
### Quit
|
||||
Go: `Show(ctx context.Context)`<br/>
|
||||
JS: `Show()`
|
||||
|
||||
Go Signature: `Quit(ctx context.Context)`
|
||||
### Quit
|
||||
|
||||
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.
|
||||
|
||||
Go: `Environment(ctx context.Context) EnvironmentInfo`<br/>
|
||||
JS: `Environment(): Promise<EnvironmentInfo>`
|
||||
|
||||
#### EnvironmentInfo
|
||||
|
||||
Go:
|
||||
```go
|
||||
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;
|
||||
}
|
||||
```
|
||||
|
||||
@@ -4,8 +4,6 @@ sidebar_position: 3
|
||||
|
||||
# Log
|
||||
|
||||
## Overview
|
||||
|
||||
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:
|
||||
|
||||
@@ -21,108 +19,97 @@ level will output all messages except `Trace` messages.
|
||||
|
||||
### LogPrint
|
||||
|
||||
Go Signature: `LogPrint(ctx context.Context, message string)`
|
||||
|
||||
JS Signature: `LogPrint(message: string)`
|
||||
|
||||
Logs the given message as a raw message.
|
||||
|
||||
Go: `LogPrint(ctx context.Context, message string)`<br/>
|
||||
JS: `LogPrint(message: string)`
|
||||
|
||||
### LogPrintf
|
||||
|
||||
Go Signature: `LogPrintf(ctx context.Context, format string, args ...interface{})`
|
||||
|
||||
Logs the given message as a raw message.
|
||||
|
||||
Go: `LogPrintf(ctx context.Context, format string, args ...interface{})`<br/>
|
||||
|
||||
### LogTrace
|
||||
|
||||
Go Signature: `LogTrace(ctx context.Context, message string)`
|
||||
|
||||
JS Signature: `LogTrace(message: string)`
|
||||
|
||||
Logs the given message at the `Trace` log level.
|
||||
|
||||
Go: `LogTrace(ctx context.Context, message string)`<br/>
|
||||
JS: `LogTrace(message: string)`
|
||||
|
||||
### LogTracef
|
||||
|
||||
Go Signature: `LogTracef(ctx context.Context, format string, args ...interface{})`
|
||||
|
||||
Logs the given message at the `Trace` log level.
|
||||
|
||||
Go: `LogTracef(ctx context.Context, format string, args ...interface{})`<br/>
|
||||
|
||||
### LogDebug
|
||||
|
||||
Go Signature: `LogDebug(ctx context.Context, message string)`
|
||||
|
||||
JS Signature: `LogDebug(message: string)`
|
||||
|
||||
Logs the given message at the `Debug` log level.
|
||||
|
||||
Go: `LogDebug(ctx context.Context, message string)`<br/>
|
||||
JS: `LogDebug(message: string)`
|
||||
|
||||
### LogDebugf
|
||||
|
||||
Go Signature: `LogDebugf(ctx context.Context, format string, args ...interface{})`
|
||||
|
||||
Logs the given message at the `Debug` log level.
|
||||
|
||||
Go: `LogDebugf(ctx context.Context, format string, args ...interface{})`<br/>
|
||||
|
||||
### LogInfo
|
||||
|
||||
Go Signature: `LogInfo(ctx context.Context, message string)`
|
||||
|
||||
JS Signature: `LogInfo(message: string)`
|
||||
|
||||
Logs the given message at the `Info` log level.
|
||||
|
||||
Go: `LogInfo(ctx context.Context, message string)`<br/>
|
||||
JS: `LogInfo(message: string)`
|
||||
|
||||
### LogInfof
|
||||
|
||||
Go Signature: `LogInfof(ctx context.Context, format string, args ...interface{})`
|
||||
|
||||
Logs the given message at the `Info` log level.
|
||||
|
||||
Go: `LogInfof(ctx context.Context, format string, args ...interface{})`<br/>
|
||||
|
||||
### LogWarning
|
||||
|
||||
Go Signature: `LogWarning(ctx context.Context, message string)`
|
||||
|
||||
JS Signature: `LogWarning(message: string)`
|
||||
|
||||
Logs the given message at the `Warning` log level.
|
||||
|
||||
Go: `LogWarning(ctx context.Context, message string)`<br/>
|
||||
JS: `LogWarning(message: string)`
|
||||
|
||||
### LogWarningf
|
||||
|
||||
Go Signature: `LogWarningf(ctx context.Context, format string, args ...interface{})`
|
||||
|
||||
Logs the given message at the `Warning` log level.
|
||||
|
||||
Go: `LogWarningf(ctx context.Context, format string, args ...interface{})`<br/>
|
||||
|
||||
### LogError
|
||||
|
||||
Go Signature: `LogError(ctx context.Context, message string)`
|
||||
|
||||
JS Signature: `LogError(message: string)`
|
||||
|
||||
Logs the given message at the `Error` log level.
|
||||
|
||||
Go: `LogError(ctx context.Context, message string)`<br/>
|
||||
JS: `LogError(message: string)`
|
||||
|
||||
### LogErrorf
|
||||
|
||||
Go Signature: `LogErrorf(ctx context.Context, format string, args ...interface{})`
|
||||
|
||||
Logs the given message at the `Error` log level.
|
||||
|
||||
Go: `LogErrorf(ctx context.Context, format string, args ...interface{})`<br/>
|
||||
|
||||
### LogFatal
|
||||
|
||||
Go Signature: `LogFatal(ctx context.Context, message string)`
|
||||
|
||||
JS Signature: `LogFatal(message: string)`
|
||||
|
||||
Logs the given message at the `Fatal` log level.
|
||||
|
||||
Go: `LogFatal(ctx context.Context, message string)`<br/>
|
||||
JS: `LogFatal(message: string)`
|
||||
|
||||
### LogFatalf
|
||||
|
||||
Go Signature: `LogFatalf(ctx context.Context, format string, args ...interface{})`
|
||||
|
||||
Logs the given message at the `Fatal` log level.
|
||||
|
||||
Go: `LogFatalf(ctx context.Context, format string, args ...interface{})`<br/>
|
||||
|
||||
### 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:
|
||||
|
||||
| Value | Log Level |
|
||||
@@ -133,6 +120,9 @@ Sets the log level. In Javascript, the number relates to the following log level
|
||||
| 4 | Warning |
|
||||
| 5 | Error |
|
||||
|
||||
Go: `LogSetLogLevel(ctx context.Context, level logger.LogLevel)`<br/>
|
||||
JS: `LogSetLogLevel(level: number)`
|
||||
|
||||
## Using a Custom Logger
|
||||
|
||||
A custom logger may be used by providing it using the [Logger](../options.mdx#logger)
|
||||
|
||||
@@ -4,8 +4,6 @@ sidebar_position: 6
|
||||
|
||||
# Menu
|
||||
|
||||
## Overview
|
||||
|
||||
These methods are related to the application menu.
|
||||
|
||||
:::info Javascript
|
||||
@@ -14,12 +12,12 @@ Menu is currently unsupported in the JS runtime.
|
||||
|
||||
### 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
|
||||
|
||||
Go Signature: `MenuUpdateApplicationMenu(ctx context.Context)`
|
||||
|
||||
Updates the application menu, picking up any changes to the menu passed to `MenuSetApplicationMenu`.
|
||||
|
||||
Go: `MenuUpdateApplicationMenu(ctx context.Context)`
|
||||
|
||||
@@ -4,226 +4,196 @@ sidebar_position: 4
|
||||
|
||||
# Window
|
||||
|
||||
## Overview
|
||||
|
||||
These methods give control of the application window.
|
||||
|
||||
### WindowSetTitle
|
||||
|
||||
Go Signature: `WindowSetTitle(ctx context.Context, title string)`
|
||||
|
||||
JS Signature: `WindowSetTitle(title: string)`
|
||||
|
||||
Sets the text in the window title bar.
|
||||
|
||||
Go: `WindowSetTitle(ctx context.Context, title string)`<br/>
|
||||
JS: `WindowSetTitle(title: string)`
|
||||
|
||||
### WindowFullscreen
|
||||
|
||||
Go Signature: `WindowFullscreen(ctx context.Context)`
|
||||
|
||||
JS Signature: `WindowFullscreen()`
|
||||
|
||||
Makes the window full screen.
|
||||
|
||||
Go: `WindowFullscreen(ctx context.Context)`<br/>
|
||||
JS: `WindowFullscreen()`
|
||||
|
||||
### WindowUnfullscreen
|
||||
|
||||
Go Signature: `WindowUnfullscreen(ctx context.Context)`
|
||||
|
||||
JS Signature: `WindowUnfullscreen()`
|
||||
|
||||
Restores the previous window dimensions and position prior to full screen.
|
||||
|
||||
Go: `WindowUnfullscreen(ctx context.Context)`<br/>
|
||||
JS: `WindowUnfullscreen()`
|
||||
|
||||
### WindowCenter
|
||||
|
||||
Go Signature: `WindowCenter(ctx context.Context)`
|
||||
|
||||
JS Signature: `WindowCenter()`
|
||||
|
||||
Centers the window on the monitor the window is currently on.
|
||||
|
||||
Go: `WindowCenter(ctx context.Context)`<br/>
|
||||
JS: `WindowCenter()`
|
||||
|
||||
### WindowReload
|
||||
|
||||
Go Signature: `WindowReload(ctx context.Context)`
|
||||
|
||||
JS Signature: `WindowReload()`
|
||||
|
||||
Performs a "reload" (Reloads current page).
|
||||
|
||||
Go: `WindowReload(ctx context.Context)`<br/>
|
||||
JS: `WindowReload()`
|
||||
|
||||
### WindowReloadApp
|
||||
|
||||
Go Signature: `WindowReloadApp(ctx context.Context)`
|
||||
|
||||
JS Signature: `WindowReloadApp()`
|
||||
|
||||
Reloads the application frontend.
|
||||
|
||||
### WindowSetSy
|
||||
Go: `WindowReloadApp(ctx context.Context)`<br/>
|
||||
JS: `WindowReloadApp()`
|
||||
|
||||
### WindowSetSystemDefaultTheme
|
||||
|
||||
Go Signature: `WindowSetSystemDefaultTheme(ctx context.Context)`
|
||||
|
||||
JS Signature: `WindowSetSystemDefaultTheme()`
|
||||
|
||||
Windows only.
|
||||
|
||||
Go: `WindowSetSystemDefaultTheme(ctx context.Context)`<br/>
|
||||
JS: `WindowSetSystemDefaultTheme()`
|
||||
|
||||
Sets window theme to system default (dark/light).
|
||||
|
||||
### WindowSetLightTheme
|
||||
|
||||
Go Signature: `WindowSetLightTheme(ctx context.Context)`
|
||||
|
||||
JS Signature: `WindowSetLightTheme()`
|
||||
|
||||
Windows only.
|
||||
|
||||
Go: `WindowSetLightTheme(ctx context.Context)`<br/>
|
||||
JS: `WindowSetLightTheme()`
|
||||
|
||||
Sets window theme to light.
|
||||
|
||||
### WindowSetDarkTheme
|
||||
|
||||
Go Signature: `WindowSetDarkTheme(ctx context.Context)`
|
||||
|
||||
JS Signature: `WindowSetDarkTheme()`
|
||||
|
||||
Windows only.
|
||||
|
||||
Go: `WindowSetDarkTheme(ctx context.Context)`<br/>
|
||||
JS: `WindowSetDarkTheme()`
|
||||
|
||||
Sets window theme to dark.
|
||||
|
||||
### WindowShow
|
||||
|
||||
Go Signature: `WindowShow(ctx context.Context)`
|
||||
|
||||
JS Signature: `WindowShow()`
|
||||
|
||||
Shows the window, if it is currently hidden.
|
||||
|
||||
Go: `WindowShow(ctx context.Context)`<br/>
|
||||
JS: `WindowShow()`
|
||||
|
||||
### WindowHide
|
||||
|
||||
Go Signature: `WindowHide(ctx context.Context)`
|
||||
|
||||
JS Signature: `WindowHide()`
|
||||
|
||||
Hides the window, if it is currently visible.
|
||||
|
||||
Go: `WindowHide(ctx context.Context)`<br/>
|
||||
JS: `WindowHide()`
|
||||
|
||||
### WindowSetSize
|
||||
|
||||
Go Signature: `WindowSetSize(ctx context.Context, width int, height int)`
|
||||
|
||||
JS Signature: `WindowSetSize(size: Size)`
|
||||
|
||||
Sets the width and height of the window.
|
||||
|
||||
Go: `WindowSetSize(ctx context.Context, width int, height int)`<br/>
|
||||
JS: `WindowSetSize(size: Size)`
|
||||
|
||||
### WindowGetSize
|
||||
|
||||
Go Signature: `WindowGetSize(ctx context.Context) (width int, height int)`
|
||||
|
||||
JS Signature: `WindowGetSize() : Size`
|
||||
|
||||
Gets the width and height of the window.
|
||||
|
||||
Go: `WindowGetSize(ctx context.Context) (width int, height int)`<br/>
|
||||
JS: `WindowGetSize() : Size`
|
||||
|
||||
### WindowSetMinSize
|
||||
|
||||
Go Signature: `WindowSetMinSize(ctx context.Context, width int, height int)`
|
||||
|
||||
JS Signature: `WindowSetMinSize(size: Size)`
|
||||
|
||||
Sets the minimum window size.
|
||||
Will resize the window if the window is currently smaller than the given dimensions.
|
||||
|
||||
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
|
||||
|
||||
Go Signature: `WindowSetMaxSize(ctx context.Context, width int, height int)`
|
||||
|
||||
JS Signature: `WindowSetMaxSize(size: Size)`
|
||||
|
||||
Sets the maximum window size.
|
||||
Will resize the window if the window is currently larger than the given dimensions.
|
||||
|
||||
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
|
||||
|
||||
Go Signature: `WindowSetAlwaysOnTop(ctx context.Context, b bool)`
|
||||
|
||||
JS Signature: `WindowSetAlwaysOnTop(b: Boolen)`
|
||||
|
||||
Sets the window AlwaysOnTop or not on top.
|
||||
|
||||
Go: `WindowSetAlwaysOnTop(ctx context.Context, b bool)`<br/>
|
||||
JS: `WindowSetAlwaysOnTop(b: Boolen)`
|
||||
|
||||
### 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.
|
||||
|
||||
Go: `WindowSetPosition(ctx context.Context, x int, y int)`<br/>
|
||||
JS: `WindowSetPosition(position: Position)`
|
||||
|
||||
### 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.
|
||||
|
||||
Go: `WindowGetPosition(ctx context.Context) (x int, y int)`<br/>
|
||||
JS: `WindowGetPosition() : Position`
|
||||
|
||||
### WindowMaximise
|
||||
|
||||
Go Signature: `WindowMaximise(ctx context.Context)`
|
||||
|
||||
JS Signature: `WindowMaximise()`
|
||||
|
||||
Maximises the window to fill the screen.
|
||||
|
||||
Go: `WindowMaximise(ctx context.Context)`<br/>
|
||||
JS: `WindowMaximise()`
|
||||
|
||||
### WindowUnmaximise
|
||||
|
||||
Go Signature: `WindowUnmaximise(ctx context.Context)`
|
||||
|
||||
JS Signature: `WindowUnmaximise()`
|
||||
|
||||
Restores the window to the dimensions and position prior to maximising.
|
||||
|
||||
Go: `WindowUnmaximise(ctx context.Context)`<br/>
|
||||
JS: `WindowUnmaximise()`
|
||||
|
||||
### WindowToggleMaximise
|
||||
|
||||
Go Signature: `WindowToggleMaximise(ctx context.Context)`
|
||||
|
||||
JS Signature: `WindowToggleMaximise()`
|
||||
|
||||
Toggles between Maximised and UnMaximised.
|
||||
|
||||
Go: `WindowToggleMaximise(ctx context.Context)`<br/>
|
||||
JS: `WindowToggleMaximise()`
|
||||
|
||||
### WindowMinimise
|
||||
|
||||
Go Signature: `WindowMinimise(ctx context.Context)`
|
||||
|
||||
JS Signature: `WindowMinimise()`
|
||||
|
||||
Minimises the window.
|
||||
|
||||
Go: `WindowMinimise(ctx context.Context)`<br/>
|
||||
JS: `WindowMinimise()`
|
||||
|
||||
### WindowUnminimise
|
||||
|
||||
Go Signature: `WindowUnminimise(ctx context.Context)`
|
||||
|
||||
JS Signature: `WindowUnminimise()`
|
||||
|
||||
Restores the window to the dimensions and position prior to minimising.
|
||||
|
||||
Go: `WindowUnminimise(ctx context.Context)`<br/>
|
||||
JS: `WindowUnminimise()`
|
||||
|
||||
### 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.
|
||||
This colour will show through for all transparent pixels.
|
||||
|
||||
Valid values for R, G, B and A are 0-255.
|
||||
|
||||
:::info Windows
|
||||
|
||||
On Windows, only alpha values of 0 or 255 are supported.
|
||||
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
|
||||
|
||||
### Position
|
||||
|
||||
Reference in New Issue
Block a user