Docs versioning (#1299)

* Add beta.34 version

* Fix up document links
This commit is contained in:
Lea Anthony
2022-03-30 23:21:33 +11:00
committed by GitHub
parent 085d59612b
commit 4cedfdc091
75 changed files with 3937 additions and 61 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ sidebar_position: 1
# Templates
This page serves as a list for community supported templates. Please submit a PR (click `Edit this page` at the bottom)
to include your templates. To build your own template, please see the [Templates](/docs/guides/templates) guide.
to include your templates. To build your own template, please see the [Templates](../guides/templates.mdx) guide.
To use these templates, run `wails init -n "Your Project Name" -t [the link below[@version]]`
+1 -1
View File
@@ -15,5 +15,5 @@ If you run the binary, you should see the default application:
<br/>
For more details on compilation options, please refer to the [CLI Reference](/docs/reference/cli#build).
For more details on compilation options, please refer to the [CLI Reference](../reference/cli.mdx#build).
+1 -1
View File
@@ -10,6 +10,6 @@ You can run your application in development mode by running `wails dev` from you
- Watch for modifications in your Go files and rebuild/re-run on change
- Sets up a [webserver](http://localhost:34115) that will serve your application over a browser. This allows you to use your favourite browser extensions. You can even call your Go code from the console.
To get started, run `wails dev` in the project directory. More information on this can be found [here](/docs/reference/cli#dev).
To get started, run `wails dev` in the project directory. More information on this can be found [here](../reference/cli.mdx#dev).
Coming soon: Tutorial
+2 -2
View File
@@ -12,10 +12,10 @@ To get up and running quickly, you can generate a default project by running `wa
create a directory called `myproject` and populate it with the default template.
Other project templates are available and can be listed using `wails init -l`.
There are also [community templates](/docs/community/templates) available that offer different capabilities and frameworks.
There are also [community templates](../community/templates.mdx) available that offer different capabilities and frameworks.
To see the other options available, you can run `wails init -help`.
More details can be found in the [CLI Reference](/docs/reference/cli#init).
More details can be found in the [CLI Reference](../reference/cli.mdx#init).
## Project Layout
+2 -3
View File
@@ -22,7 +22,7 @@ Wails has a number of common dependencies that are required before installation:
Download Go from the [Go Downloads Page](https://golang.org/dl/).
Ensure that you follow the official [Go installation instructions](https://golang.org/doc/install#install). You will also need to ensure that your `PATH` environment variable also includes the path to your `~/go/bin` directory. Restart your terminal and do the following checks:
Ensure that you follow the official [Go installation instructions](https://golang.org/doc/install.mdx#install). You will also need to ensure that your `PATH` environment variable also includes the path to your `~/go/bin` directory. Restart your terminal and do the following checks:
- Check Go is installed correctly: `go version`
- Check "~/go/bin" is in your PATH variable: `echo $PATH | grep go/bin`
@@ -61,8 +61,7 @@ import TabItem from "@theme/TabItem";
<TabItem value="Linux">Linux required the standard <code>gcc</code> build tools plus <code>libgtk3</code> and <code>libwebkit</code>.
Rather than list a ton of commands for different distros, Wails can try to determine
what the installation commands are for your specific distribution. Run <code>wails doctor</code> after installation
to be shown how to install the dependencies. If your distro/package manager is not supported, please consult the
<a href="/docs/guides/linux-distro-support"> Add Linux Distro</a> guide.</TabItem>
to be shown how to install the dependencies.</TabItem>
</Tabs>
## Optional Dependencies
@@ -30,7 +30,7 @@ func (a *App) shutdown(ctx context.Context) {
- The startup method is called as soon as Wails allocates the resources it needs and is a good place for creating resources,
setting up event listeners and anything else the application needs at startup.
It is given a `context.Context` which is usually saved in a struct field. This context is needed for calling the
[runtime](/docs/reference/runtime/intro). If this method returns an error, the application will terminate.
[runtime](../reference/runtime/intro.mdx). If this method returns an error, the application will terminate.
In dev mode, the error will be output to the console.
- The shutdown method will be called by Wails right at the end of the shutdown process. This is a good place to deallocate
@@ -59,7 +59,7 @@ func main() {
```
More information on application lifecycle hooks can be found [here](/docs/howdoesitwork#application-lifecycle-callbacks).
More information on application lifecycle hooks can be found [here](../howdoesitwork.mdx#application-lifecycle-callbacks).
## Binding Methods
@@ -113,11 +113,11 @@ func main() {
This will bind all public methods in our `App` struct (it will never bind the startup and shutdown methods).
More information on Binding can be found [here](/docs/howdoesitwork#method-binding).
More information on Binding can be found [here](../howdoesitwork.mdx#method-binding).
## Application Menu
Wails supports adding a menu to your application. This is done by passing a [Menu](/docs/reference/menus#menu) struct
Wails supports adding a menu to your application. This is done by passing a [Menu](../reference/menus.mdx#menu) struct
to application config. It's common to use a method that returns a Menu, and even more common for that to be a method on
the `App` struct used for the lifecycle hooks.
+2 -2
View File
@@ -1,8 +1,8 @@
# Frameless Applications
Wails supports applications with no frame. This can be achieved by using the [frameless](/docs/reference/options#frameless)
field in [Application Options](/docs/reference/options#application-options).
Wails supports applications with no frame. This can be achieved by using the [frameless](../reference/options.mdx#frameless)
field in [Application Options](../reference/options.mdx#application-options).
Wails offers a simple solution for dragging the window: Any HTML element that has the attribute "data-wails-drag" will
act as a "drag handle". This property applies to all nested elements. If you need to indicate that a nested element
+11 -11
View File
@@ -25,7 +25,7 @@ Example:
app.Run()
```
In v2, there is just a single method, `wails.Run()`, that accepts [application options](/docs/reference/options#application-options).
In v2, there is just a single method, `wails.Run()`, that accepts [application options](../reference/options.mdx#application-options).
```go title="v2"
err := wails.Run(&options.App{
@@ -43,7 +43,7 @@ In v2, there is just a single method, `wails.Run()`, that accepts [application o
In v1, it was possible to bind both arbitrary functions and structs. In v2, this has been simplified to only binding structs.
The struct instances that were previously passed to the `Bind()` method in v1, are now specified in the `Bind` field of
the [application options](/docs/reference/options#application-options):
the [application options](../reference/options.mdx#application-options):
```go title="v1"
app := wails.CreateApp(/* options */)
@@ -64,13 +64,13 @@ In v1, bound methods were available to the frontend at `window.backend`. This ha
### Application Lifecycle
In v1, there were 2 special methods in a bound struct: `WailsInit()` and `WailsShutdown()`. These have
been replaced with 3 lifecycle hooks as part of the [application options](/docs/reference/options#application-options):
been replaced with 3 lifecycle hooks as part of the [application options](../reference/options.mdx#application-options):
- [OnStartup](/docs/reference/options#onstartup)
- [OnShutdown](/docs/reference/options#onshutdown)
- [OnDomReady](/docs/reference/options#ondomready)
- [OnStartup](../reference/options.mdx#onstartup)
- [OnShutdown](../reference/options.mdx#onshutdown)
- [OnDomReady](../reference/options.mdx#ondomready)
Note: [OnDomReady](/docs/reference/options#ondomready) replaces the `wails:ready` system event in v1.
Note: [OnDomReady](../reference/options.mdx#ondomready) replaces the `wails:ready` system event in v1.
These methods can be standard functions, but a common practice is to have them part of a struct:
@@ -96,11 +96,11 @@ func (b *Basic) startup(ctx context.Context) {
The runtime in v2 is much richer than v1 with support for menus, window manipulation
and better dialogs. The signature of the methods has changed slightly - please refer
the the [Runtime Reference](/docs/reference/runtime/intro).
the the [Runtime Reference](../reference/runtime/intro.mdx).
In v1, the [runtime](/docs/reference/runtime/intro) was available via a struct passed to `WailsInit()`.
In v1, the [runtime](../reference/runtime/intro.mdx) was available via a struct passed to `WailsInit()`.
In v2, the runtime has been moved out to its own package. Each method in the runtime takes the
`context.Context` that is passed to the [OnStartup](/docs/reference/options#onstartup) method.
`context.Context` that is passed to the [OnStartup](../reference/options.mdx#onstartup) method.
```go title="Runtime Example"
package main
@@ -173,7 +173,7 @@ func main() {
Of course, bundlers can be used if you wish to. The only requirement is to pass
the final application assets directory to Wails using an `embed.FS` in the `Assets`
key of the [application options](/docs/reference/options#application-options).
key of the [application options](../reference/options.mdx#application-options).
### Project Configuration
+1 -1
View File
@@ -20,7 +20,7 @@ const router = createRouter({
## Angular
The recommended approach for routing in Angular is [HashLocationStrategy](https://codecraft.tv/courses/angular/routing/routing-strategies/#_hashlocationstrategy):
The recommended approach for routing in Angular is [HashLocationStrategy](https://codecraft.tv/courses/angular/routing/routing-strategies#_hashlocationstrategy):
```ts
RouterModule.forRoot(routes, {useHash: true})
+2 -2
View File
@@ -4,7 +4,7 @@
Wails generates projects from pre-created templates. In v1, this was a difficult to maintain set of projects that were
subject to going out of date. In v2, to empower the community, a couple of new features have been added for templates:
- Ability to generate projects from [Remote Templates](/docs/reference/cli#remote-templates)
- Ability to generate projects from [Remote Templates](../reference/cli.mdx#remote-templates)
- Tooling to help create your own templates
## Creating Templates
@@ -91,5 +91,5 @@ Publishing a template is simply pushing the files to GitHub. The following best
- Remove any unwanted files and directories (such as `.git`) from your frontend directory
- Ensure that `template.json` is complete, especially `helpurl`
- Push the files to GitHub
- Create a PR on the [Community Templates](/docs/community/templates) page
- Create a PR on the [Community Templates](../community/templates.mdx) page
- Announce the template on the [Template Announcement](https://github.com/wailsapp/wails/discussions/825) discussion board
+9 -9
View File
@@ -83,7 +83,7 @@ This example has the following options set:
- `OnShutdown` - A callback for when the application is about to quit
- `Bind` - A slice of struct instances that we wish to expose to the frontend
A full list of application options can be found in the [Options Reference](/docs/reference/options).
A full list of application options can be found in the [Options Reference](reference/options).
#### Assets
@@ -108,17 +108,17 @@ the application.
When running in development mode using the `wails dev` command, the assets are loaded off disk, and any changes result
in a "live reload". The location of the assets will be inferred from the `embed.FS`.
More details can be found in the [Application Development Guide](/docs/guides/application-development).
More details can be found in the [Application Development Guide](guides/application-development.mdx).
#### Application Lifecycle Callbacks
Just before the frontend is about to load `index.html`, a callback is made to the function provided in [OnStartup](/docs/reference/options#OnStartup).
Just before the frontend is about to load `index.html`, a callback is made to the function provided in [OnStartup](reference/options.mdx#onstartup).
A standard Go context is passed to this method. This context is required when calling the runtime so a standard pattern is to save
a reference to in this method. Just before the application shuts down, the [OnShutdown](/docs/reference/options#OnShutdown) callback is called in the same way,
again with the context. There is also an [OnDomReady](/docs/reference/options#OnDomReady) callback for when the frontend
a reference to in this method. Just before the application shuts down, the [OnShutdown](reference/options.mdx#onshutdown) callback is called in the same way,
again with the context. There is also an [OnDomReady](reference/options.mdx#ondomready) callback for when the frontend
has completed loading all assets in `index.html` and is equivalent of the [`body onload`](https://www.w3schools.com/jsref/event_onload.asp) event in Javascript.
It is also possible to hook into the window close (or application quit) event by setting the
option [OnBeforeClose](/docs/reference/options#OnBeforeClose).
option [OnBeforeClose](reference/options.mdx#onbeforeclose).
#### Method Binding
@@ -227,8 +227,8 @@ is expecting a struct, will be converted to that struct type. To make this proce
a TypeScript module is generated, defining all the struct types used in bound methods. Using this module, it's possible
to construct and send native Javascript objects to the Go code.
More information on Binding can be found in the [Binding Methods](/docs/guides/application-development#binding-methods)
section of the [Application Development Guide](/docs/guides/application-development).
More information on Binding can be found in the [Binding Methods](guides/application-development.mdx#binding-methods)
section of the [Application Development Guide](guides/application-development.mdx).
## The Frontend
@@ -412,4 +412,4 @@ tasks such as emit an event or perform logging operations:
window.runtime.EventsEmit("my-event", 1);
```
More details about the JS runtime can be found in the [Runtime Reference](/docs/reference/runtime/intro).
More details about the JS runtime can be found in the [Runtime Reference](reference/runtime/intro).
+8 -8
View File
@@ -29,7 +29,7 @@ Example:
This will generate a a project called "test" in the "mytestproject" directory, initialise git,
generate vscode project files and do so silently.
More information on using IDEs with Wails can be found [here](/docs/guides/ides).
More information on using IDEs with Wails can be found [here](../guides/ides.mdx).
### Remote Templates
@@ -38,7 +38,7 @@ Remote templates (hosted on GitHub) are supported and can be installed by using
Example:
`wails init -n test -t https://github.com/leaanthony/testtemplate[@v1.0.0]`
A list of community maintained templates can be found [here](/docs/community/templates)
A list of community maintained templates can be found [here](../community/templates.mdx)
:::warning Attention
@@ -54,7 +54,7 @@ A list of community maintained templates can be found [here](/docs/community/tem
| Flag | Description | Default |
| :------------------- | :-------------------------------------- | :------------------------- |
| -platform | Build for the given (comma delimited) [platforms](/docs/reference/cli#platforms) eg. `windows/arm64`. Note, if you do not give the architecture, `runtime.GOARCH` is used. | runtime.GOOS/runtime.GOARCH |
| -platform | Build for the given (comma delimited) [platforms](../reference/cli.mdx#platforms) eg. `windows/arm64`. Note, if you do not give the architecture, `runtime.GOARCH` is used. | runtime.GOOS/runtime.GOARCH |
| -clean | Cleans the `build/bin` directory | |
| -compiler "compiler"| Use a different go compiler to build, eg go1.15beta1 | go |
| -ldflags "flags" | Additional ldflags to pass to the compiler | |
@@ -70,9 +70,9 @@ A list of community maintained templates can be found [here](/docs/community/tem
| -u | Updates your project's `go.mod` to use the same version of Wails as the CLI | |
| -debug | Retains debug information in the application | false |
For a detailed description of the `webview2` flag, please refer to the [Windows](/docs/guides/windows) Guide.
For a detailed description of the `webview2` flag, please refer to the [Windows](../guides/windows.mdx) Guide.
If you prefer to build using standard Go tooling, please consult the [Manual Builds](/docs/guides/manual-builds)
If you prefer to build using standard Go tooling, please consult the [Manual Builds](../guides/manual-builds.mdx)
guide.
Example:
@@ -182,12 +182,12 @@ Example:
This command will do the following:
- Build the application and run it (more details [here](/docs/guides/manual-builds)
- Build the application and run it (more details [here](../guides/manual-builds.mdx)
- Generate the Wails JS modules in `./frontend/src`
- Watch for updates to files in `./frontend/dist` and reload on any change
- Open a browser and connect to the application
There is more information on using this feature with existing framework scripts [here](/docs/guides/application-development#live-reloading).
There is more information on using this feature with existing framework scripts [here](../guides/application-development.mdx#live-reloading).
## generate
@@ -201,7 +201,7 @@ it may be used for generating projects.
| -name | The template name (Mandatory) |
| -frontend "path" | Path to frontend project to use in template |
For more details on creating templates, consult the [Templates guide](/docs/guides/templates).
For more details on creating templates, consult the [Templates guide](../guides/templates.mdx).
## update
+2 -2
View File
@@ -5,10 +5,10 @@ sidebar_position: 4
# Menus
It is possible to add an application menu to Wails projects. This is achieved by defining a [Menu](#menu) struct and
setting the [`Menu`](/docs/reference/options#menu) option, or by calling the runtime method [MenuSetApplicationMenu](/docs/reference/runtime/menu#menusetapplicationmenu).
setting the [`Menu`](../reference/options.mdx#menu) option, or by calling the runtime method [MenuSetApplicationMenu](../reference/runtime/menu.mdx#menusetapplicationmenu).
It is also possible to dynamically update the menu, by updating the menu struct and calling
[MenuUpdateApplicationMenu](/docs/reference/runtime/menu#menuupdateapplicationmenu).
[MenuUpdateApplicationMenu](../reference/runtime/menu.mdx#menuupdateapplicationmenu).
Example:
+5 -5
View File
@@ -137,7 +137,7 @@ Name: Frameless
Type: bool
When set to `true`, the window will have no borders or title bar.
Also see [Frameless Windows](/docs/guides/frameless).
Also see [Frameless Windows](../guides/frameless.mdx).
### MinWidth
@@ -181,7 +181,7 @@ Name: StartHidden
Type: bool
When set to `true`, the application will be hidden until [WindowShow](/docs/reference/runtime/window#WindowShow)
When set to `true`, the application will be hidden until [WindowShow](../reference/runtime/window.mdx#windowshow)
is called.
### HideWindowOnClose
@@ -225,7 +225,7 @@ Name: Menu
Type: \*menu.Menu
The menu to be used by the application. More details about Menus in the [Menu Reference](/docs/reference/runtime/menu).
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.
@@ -237,7 +237,7 @@ Type: logger.Logger
Default: Logger to Stdout
The logger to be used by the application. More details about logging in the [Log Reference](/docs/reference/runtime/log).
The logger to be used by the application. More details about logging in the [Log Reference](../reference/runtime/log.mdx).
### LogLevel
@@ -247,7 +247,7 @@ Type: logger.LogLevel
Default: `Info` in dev mode, `Error` in production mode
The default log level. More details about logging in the [Log Reference](/docs/reference/runtime/log).
The default log level. More details about logging in the [Log Reference](../reference/runtime/log.mdx).
### OnStartup
+4 -4
View File
@@ -8,15 +8,15 @@ The runtime is a library that provides utility methods for your application. The
and the aim is to try and keep them at parity where possible.
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](/docs/reference/options#onstartup)
or [OnDomReady](/docs/reference/options#ondomready) hooks.
take a context as the first parameter. This context should be obtained from the [OnStartup](../options.mdx#onstartup)
or [OnDomReady](../options.mdx#ondomready) hooks.
:::info Note
Whilst the context will be provided to the
[OnStartup](/docs/reference/options#onstartup) method, there's no guarantee the runtime will work in this method as
[OnStartup](../options.mdx#onstartup) method, there's no guarantee the runtime will work in this method as
the window is initialising in a different thread. If
you wish to call runtime methods at startup, use [OnDomReady](/docs/reference/options#ondomready).
you wish to call runtime methods at startup, use [OnDomReady](../options.mdx#ondomready).
:::
+1 -1
View File
@@ -96,7 +96,7 @@ Sets the log level. In Javascript, the number relates to the following log level
## Using a Custom Logger
A custom logger may be used by providing it using the [Logger](/docs/reference/options#logger)
A custom logger may be used by providing it using the [Logger](../options.mdx#logger)
application option. The only requirement is that the logger implements the `logger.Logger` interface
defined in `github.com/wailsapp/wails/v2/pkg/logger`:
+1 -1
View File
@@ -15,7 +15,7 @@ These methods are related to the application menu.
### MenuSetApplicationMenu
Go Signature: `MenuSetApplicationMenu(ctx context.Context, menu *menu.Menu)`
Sets the application menu to the given [menu](/docs/reference/menus) .
Sets the application menu to the given [menu](../menus.mdx) .
### MenuUpdateApplicationMenu
Go Signature: `MenuUpdateApplicationMenu(ctx context.Context)`
@@ -117,7 +117,7 @@ sidebar_position: 99
## 贡献者
import Contributors from "react-github-contributors";
import Contributors from "@wails/react-contributors";
<Contributors owner="wailsapp" repo="wails" />
@@ -67,8 +67,7 @@ import TabItem from "@theme/TabItem";
<code>libwebkit</code>。与其为不同的发行版列出大量命令,Wails
可以尝试确定针对您的特定发行版的安装命令。安装后运行
<code>wails doctor</code>
以显示如何安装依赖项。如果不支持您的发行版/包管理器,请参阅
<a href="/docs/guides/linux-distro-support">添加Linux发行版</a>指南。
以显示如何安装依赖项。
</TabItem>
</Tabs>
Binary file not shown.

After

Width:  |  Height:  |  Size: 424 KiB

Some files were not shown because too many files have changed in this diff Show More