Compare commits

..

51 Commits

Author SHA1 Message Date
Atterpac 9c4b412aea fix react template css (#3477)
changelog
2024-05-14 06:39:20 +10:00
Atterpac 71b2edc0fe [V3-Linux] Upgrade to Webkitgtk4.1 (#3461)
* webkitgtk4.0->webkitgtk4.1

changelog

* Update mkdocs-website/docs/en/changelog.md

* Update deps in pipeline

* Update deps in pipeline

* Install 4.1 only when v3

* Install 4.1 only when v3

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2024-05-08 18:08:14 +10:00
Lea Anthony 7661cd189f Fix Go version 2024-05-08 08:27:38 +10:00
Mike D Pilsbury 0833a6d6d3 [v3] Correct detection of npm with acceptable version (#3458)
* Correct detection of npm with acceptable version

* Update changelog
2024-05-06 08:29:28 +10:00
Lea Anthony 7d851d8434 Fix disable min/max buttons on windows 2024-05-06 08:26:41 +10:00
Atterpac 2c29e1ca76 update devmode to use types and yaml (#3454)
go mod update
2024-05-05 17:27:53 +10:00
Travis McLane 5a57ee99ac example: environment - change css
text was colored white and therefore invisible.
2024-05-03 12:52:15 -05:00
Travis McLane 735b6b6c87 noop: remove Println for events.Linux.ApplicationStartup 2024-05-02 15:31:49 -05:00
Travis McLane 7ea0601fc6 remove Println
unknown key codes shouldn't print out to stdout
2024-05-02 11:02:21 -05:00
Travis McLane 99537f2816 remove Register/UnregisterWindow functionality
- this is no longer needed
2024-05-02 09:37:23 -05:00
Harry Fox b384bb885b add missing map init from application.init() (#3426)
* add missing map init from `application.init()`

* add changelog entry for #3426

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2024-05-02 21:57:51 +10:00
abichinger 2255af1c45 [v3] Add port flag to dev command (#3429)
* Add `port` flag to dev command, ...

Add support for environment variable WAILS_VITE_PORT

* Check if port is already in use

* Update changelog

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2024-05-02 21:48:50 +10:00
Fabio Massaioli f55b781d86 [v3] Binding runtime fixes (#3431)
* Unmarshal arguments to appropriate type in binding calls

* Marshal multiple return values to arrays in binding calls

* Improve logging of remote method calls

* Add tests for `BoundMethod.Call`

* Fix return value if error is nil

* Update changelog

---------

Co-authored-by: Andreas Bichinger <andreas.bichinger@gmail.com>
2024-05-02 21:46:07 +10:00
Lea Anthony 38d9a9551f Add -trimpath for production build in project taskfile 2024-04-29 17:58:48 +10:00
Lea Anthony c38cee0a4a More optimised production build in project taskfile 2024-04-29 17:40:46 +10:00
Lea Anthony 0f9c7b1bbf Fix nanoid dep for npm package 2024-04-28 19:43:37 +10:00
Lea Anthony 32ddbd8e05 set target branch to v3-alpha 2024-04-28 17:13:59 +10:00
Lea Anthony 67c493f1a8 Fix example building 2024-04-27 17:43:58 +10:00
Lea Anthony 69c513e33d Fix pipeline tests 2024-04-27 17:38:10 +10:00
Lea Anthony 82b910dd6d Fix pipeline tests 2024-04-27 17:16:21 +10:00
Lea Anthony 5d0a58cc6a Update GetRelative/AbsolutePosition to take border size into account 2024-04-25 15:59:33 +10:00
Lea Anthony 368ca13314 Update window interface 2024-04-25 15:26:31 +10:00
Lea Anthony 2cee1edcb5 Add window.GetBorderSizes 2024-04-25 15:22:01 +10:00
Travis McLane 1b288a0a1a removing experimental server plugin 2024-04-23 09:32:21 -05:00
Harry Fox 81aba310d0 update Taskfile.tmpl.yml to include darwin run task (#3417)
* update Taskfile.tmpl.yml to include darwin run task

* add changelog line for #3417
2024-04-23 18:19:25 +10:00
Atterpac b050a07362 dev mode adapt to OS (#3412)
changelog
2024-04-22 12:44:10 +10:00
Travis McLane 021efab84d allow for non-Window WailsEvent listeners (#3406)
* allow for non-Window WailsEvent listeners

- adds a RegisterListener function on the App struct such
  that code can listen for WailsEvent(s) even if it isn't a Window
- rename dispatchEventToWindows -> dispatchEventToListeners
- add all windows and WailsEventListeners to slice before emitting

* Update v3/pkg/application/application.go

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2024-04-20 09:39:57 +10:00
Atterpac 0a42a050bd fix dev mode windows pipe (#3402) 2024-04-18 23:14:20 +10:00
abichinger 9ca1b30da1 [v3 alpha] Fix drag-n-drop on some linux distros (#3346)
* Fix drag and drop on linux

- Move C code

* Use GTK_DEST_DEFAULT_DROP

* Update changelog

* Move C code back into `linux_cgo.go`
2024-04-15 10:05:23 -05:00
Atterpac 220d5535f7 revert dialog channel close (#3395)
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2024-04-15 18:03:35 +10:00
Atterpac 0895e6a508 refresh version up (#3391) 2024-04-15 16:57:19 +10:00
Lea Anthony ed5532a535 Update plugin docs 2024-04-14 21:47:37 +10:00
Lea Anthony 6f41dbf954 Merge branch 'refs/heads/v3-alpha-feature/plugin-updates' into v3-alpha 2024-04-14 21:42:16 +10:00
Lea Anthony c7ed7e72d4 Major plugin updates 2024-04-14 21:41:33 +10:00
abichinger a7208f5262 Update changelog (#3389) 2024-04-11 23:50:04 +10:00
Travis McLane 09f6680aa9 restore: run tests only after approval 2024-04-10 09:11:36 -05:00
Travis McLane 9261130fed chore: workflow update to run tests on correct directory 2024-04-09 16:57:04 -05:00
Travis McLane fec22e0052 chore: bump staticanalysis to v2.8.0 2024-04-09 16:37:50 -05:00
abichinger 7c921d6a81 [v3 alpha] implement setIcon on linux (#3354)
* implement `linuxApp.setIcon`

* Move code into `linux_cgo.go`
2024-04-09 11:04:54 -05:00
Travis McLane 16a029754f disable 'server' example
Doesn't compile currently.
Disabling such that the workflow succeeds
2024-04-08 13:29:42 -05:00
Travis McLane 3c9fd67fd0 doctor: correct compilation errors 2024-04-08 13:23:12 -05:00
Travis McLane 724ca386e7 Merge remote-tracking branch 'origin/v3-alpha-linux-dialogs' into v3-alpha 2024-04-08 11:17:56 -05:00
atterpac 6f75b00463 Proper syncing and canceling of dialogs
s

s

s
2024-04-08 11:17:05 -05:00
Travis McLane 105d9f0d3a allow directory selection 2024-04-07 16:42:33 -05:00
atterpac 38f6b1297d Call linux dialog on main thread 2024-04-07 16:42:33 -05:00
Lea Anthony cf130a6e25 [windows] Fix directory select in Open Dialog 2024-04-06 14:38:43 +11:00
Lea Anthony e91c30fad0 Small doctor improvements 2024-04-03 20:48:55 +11:00
Lea Anthony 3e3f7b9273 Update discord link 2024-04-03 08:27:32 +11:00
Lea Anthony 88ff84f5a5 [windows] Improve Set window icon when in debug mode 2024-04-01 05:02:39 +11:00
Lea Anthony eee373f15a [windows] Set window icon when in debug mode 2024-04-01 04:55:34 +11:00
Lea Anthony c839c053cb [windows] Fix min/max buttons 2024-03-29 21:44:59 +11:00
230 changed files with 4068 additions and 4836 deletions
+2 -2
View File
@@ -23,7 +23,7 @@ jobs:
- name: Install linux dependencies
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update -y && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev javascriptcoregtk-4.1-dev build-essential pkg-config
run: sudo apt-get update -y && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev javascriptcoregtk-4.1-dev build-essential pkg-config
- name: Setup Go
uses: actions/setup-go@v3
@@ -122,7 +122,7 @@ jobs:
- name: Install linux dependencies
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update -y && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev javascriptcoregtk-4.1-dev build-essential pkg-config
run: sudo apt-get update -y && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev javascriptcoregtk-4.1-dev build-essential pkg-config
- name: Build Wails3 CLI
run: |
+25 -7
View File
@@ -62,8 +62,12 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3
- name: Install linux dependencies
if: matrix.os == 'ubuntu-latest'
- name: Install linux dependencies (v3)
if: ${{ matrix.os == 'ubuntu-latest' && github.event.pull_request.base.ref == 'v3-alpha' }}
run: sudo apt-get update -y && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev build-essential pkg-config
- name: Install linux dependencies (v2)
if: ${{ matrix.os == 'ubuntu-latest' && github.event.pull_request.base.ref == 'master' }}
run: sudo apt-get update -y && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev build-essential pkg-config
- name: Setup Go
@@ -71,14 +75,28 @@ jobs:
with:
go-version: ${{ matrix.go-version }}
- name: Run tests (mac)
if: matrix.os == 'macos-latest'
- name: Run tests (mac) | v2
if: ${{ matrix.os == 'macos-latest' && github.event.pull_request.base.ref == 'master' }}
env:
CGO_LDFLAGS: -framework UniformTypeIdentifiers -mmacosx-version-min=10.13
CGO_CFLAGS: -mmacosx-version-min=10.13
working-directory: ./v2
run: go test -v ./...
- name: Run tests (!mac)
if: matrix.os != 'macos-latest'
working-directory: ./v2
- name: Run tests (!mac) | v2
if: ${{ matrix.os != 'macos-latest' && github.event.pull_request.base.ref == 'master' }}
working-directory: ./v2
run: go test -v ./...
- name: Run tests (mac) | v3
if: ${{ matrix.os == 'macos-latest' && github.event.pull_request.base.ref == 'v3-alpha' }}
env:
CGO_LDFLAGS: -framework UniformTypeIdentifiers -mmacosx-version-min=10.13
CGO_CFLAGS: -mmacosx-version-min=10.13
working-directory: ./v3
run: go test -v ./...
- name: Run tests (!mac) | v3
if: ${{ matrix.os != 'macos-latest' && github.event.pull_request.base.ref == 'v3-alpha' }}
working-directory: ./v3
run: go test -v ./...
+20
View File
@@ -0,0 +1,20 @@
on:
push:
branches: ['v3-alpha']
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: "20"
- run: npm ci
working-directory: v3/internal/runtime/desktop/@wailsio/runtime
- uses: JS-DevTools/npm-publish@v3
with:
package: v3/internal/runtime/desktop/@wailsio/runtime
access: public
token: ${{ secrets.NPM_TOKEN }}
-5
View File
@@ -1,5 +0,0 @@
FROM squidfunk/mkdocs-material
RUN pip install mkdocs-macros-plugin
RUN pip install mkdocs-glightbox
RUN pip install mkdocs-table-reader-plugin
RUN pip install mkdocs-static-i18n
+26 -23
View File
@@ -5,36 +5,39 @@ This is the documentation for Wails v3. It is currently a work in progress.
If you do not wish to build it locally, it is available online at
[https://wailsapp.github.io/wails/](https://wailsapp.github.io/wails/).
## Setup Steps
## Recommended Setup Steps
1. Install the wails3 CLI if you haven't already:
Install the wails3 CLI if you haven't already:
```shell
git clone https://github.com/wailsapp/wails.git
cd wails
git checkout v3-alpha
cd v3/cmd/wails3
go install
```
2. Install [docker](https://www.docker.com)
3. Run the following command to build the docker container:
```shell
go install github.com/wailsapp/wails/v3/cmd/wails3@latest
```
```shell
wails3 task docs:setup
```
4. Serve the documentation locally:
The documentation uses mkdocs, so you will need to install
[Python](https://www.python.org/). Once installed, you can setup the
documentation by running the following command:
```shell
wails3 task docs:serve
```
```bash
wails3 task docs:setup
```
5. Open your browser to [http://127.0.0.1:8000](http://127.0.0.1:8000)
This will install the required dependencies for you.
6. For a complete build, run:
If you have installed the wails3 CLI, you can run the following command to build
the documentation and serve it locally:
```shell
wails3 task docs:build
```
```bash
wails3 task docs:serve
```
### Manual Setup
To install manually, you will need to do the following:
- Install [Python](https://www.python.org/)
- Run `pip install -r requirements.txt` to install the required dependencies
- Run `mkdocs serve` to serve the documentation locally
- Run `mkdocs build` to build the documentation
## Contributing
+9 -45
View File
@@ -7,10 +7,10 @@ tasks:
setup:
summary: Setup the project
preconditions:
- sh: docker version
msg: "Looks like docker isn't installed. Visit https://www.docker.com to download and install."
- sh: python{{exeExt}} --version
msg: "Looks like Python isn't installed. Python is required to build the documentation: https://www.python.org/downloads/"
cmds:
- docker build -t squidfunk/mkdocs-material .
- python -m pip install -r requirements.txt --user
setup:insiders:
summary: Setup the project (insiders)
@@ -31,54 +31,18 @@ tasks:
build:
summary: Builds the documentation
preconditions:
- sh: docker version
msg: "Looks like docker isn't installed. Visit https://www.docker.com to download and install."
- sh: mkdocs --version
msg: "Looks like mkdocs isn't installed. Run `wails3 task setup` or `task setup` in the documentation directory to install it."
cmds:
- build:windows
- build:unix
build:windows:
summary: Builds the documentation (Windows)
internal: true
platforms:
- windows
cmds:
- docker run --rm -v "%cd%":/docs squidfunk/mkdocs-material build
build:unix:
summary: Builds the documentation (Unix)
internal: true
platforms:
- darwin
- linux
cmds:
- docker run --rm -v "$(pwd)":/docs squidfunk/mkdocs-material build
- mkdocs build
serve:
summary: Builds the documentation and serves it locally
preconditions:
- sh: docker version
msg: "Looks like docker isn't installed. Visit https://www.docker.com to download and install."
- sh: mkdocs --version
msg: "Looks like mkdocs isn't installed. Run `wails3 task setup` or `task setup` in the documentation directory to install it."
cmds:
- task: serve:windows
- task: serve:unix
serve:windows:
summary: Builds the documentation and serves it locally (Windows)
internal: true
platforms:
- windows
cmds:
- docker run --rm -it -p 8000:8000 -v "%cd%":/docs squidfunk/mkdocs-material
serve:unix:
summary: Builds the documentation and serves it locally (Unix)
internal: true
platforms:
- darwin
- linux
cmds:
- docker run --rm -it -p 8000:8000 -v "$(pwd)":/docs squidfunk/mkdocs-material
- mkdocs serve
serve:insiders:
summary: Builds the documentation and serves it locally
+11
View File
@@ -31,9 +31,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Support multiple space-separated trigger events in the WML system by [@fbbdev](https://github.com/fbbdev) in [#3295](https://github.com/wailsapp/wails/pull/3295)
- Add ESM exports from the bundled JS runtime script by [@fbbdev](https://github.com/fbbdev) in [#3295](https://github.com/wailsapp/wails/pull/3295)
- Add binding generator flag for using the bundled JS runtime script instead of the npm package by [@fbbdev](https://github.com/fbbdev) in [#3334](https://github.com/wailsapp/wails/pull/3334)
- Implement `setIcon` on linux by [@abichinger](https://github.com/abichinger) in [#3354](https://github.com/wailsapp/wails/pull/3354)
- Add flag `-port` to dev command and support environment variable `WAILS_VITE_PORT` by [@abichinger](https://github.com/abichinger) in [#3429](https://github.com/wailsapp/wails/pull/3429)
- Add tests for bound method calls by [@abichinger](https://github.com/abichinger) in [#3431](https://github.com/wailsapp/wails/pull/3431)
### Fixed
- Fixed react template css to show footer by [atterpac](https://github.com/atterpac) in [#3477](https://github.com/wailsapp/wails/pull/3477)
- Fixed zombie processes when working in devmode by updating to latest refresh by [Atterpac](https://github.com/atterpac) in [#3320](https://github.com/wailsapp/wails/pull/3320).
- Fixed appimage webkit file sourcing by [Atterpac](https://github.com/atterpac) in [#3306](https://github.com/wailsapp/wails/pull/3306).
- Fixed Doctor apt package verify by [Atterpac](https://github.com/Atterpac) in [#2972](https://github.com/wailsapp/wails/pull/2972).
@@ -56,9 +60,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix custom context menu closing immediately on linux by [@abichinger](https://github.com/abichinger) in [#3330](https://github.com/wailsapp/wails/pull/3330)
- Fix the output path and extension of model files produced by the binding generator by [@fbbdev](https://github.com/fbbdev) in [#3334](https://github.com/wailsapp/wails/pull/3334)
- Fix the import paths of model files in JS code produced by the binding generator by [@fbbdev](https://github.com/fbbdev) in [#3334](https://github.com/wailsapp/wails/pull/3334)
- Fix drag-n-drop on some linux distros by [@abichinger](https://github.com/abichinger) in [#3346](https://github.com/wailsapp/wails/pull/3346)
- Fix missing task for macOS when using `wails3 task dev` by [@hfoxy](https://github.com/hfoxy) in [#3417](https://github.com/wailsapp/wails/pull/3417)
- Fix registering events causing a nil map assignment by [@hfoxy](https://github.com/hfoxy) in [#3426](https://github.com/wailsapp/wails/pull/3426)
- Fix unmarshaling of bound method parameters by [@fbbdev](https://github.com/fbbdev) in [#3431](https://github.com/wailsapp/wails/pull/3431)
- Fix handling of multiple return values from bound methods by [@fbbdev](https://github.com/fbbdev) in [#3431](https://github.com/wailsapp/wails/pull/3431)
- Fix doctor detection of npm that is not installed with system package manager by [@pekim](https://github.com/pekim) in [#3458](https://github.com/wailsapp/wails/pull/3458)
### Changed
- Update linux webkit dependency to webkit2gtk-4.1 over webkitgtk2-4.0 to support Ubuntu 24.04 LTS by [atterpac](https://github.com/atterpac) in [#3461](https://github.com/wailsapp/wails/pull/3461)
- The bundled JS runtime script is now an ESM module: script tags importing it must have the `type="module"` attribute. By [@fbbdev](https://github.com/fbbdev) in [#3295](https://github.com/wailsapp/wails/pull/3295)
- The `@wailsio/runtime` package does not publish its API on the `window.wails` object, and does not start the WML system. This has been done to improve encapsulation. The WML system can be started manually if desired by calling the new `WML.Enable` method. The bundled JS runtime script still performs both operations automatically. By [@fbbdev](https://github.com/fbbdev) in [#3295](https://github.com/wailsapp/wails/pull/3295)
- The Window API module `@wailsio/runtime/src/window` now exposes the containing window object as a default export. It is not possible anymore to import individual methods through ESM named or namespace import syntax.
@@ -5,7 +5,7 @@ posts before creating new ones. Here are the different ways to provide feedback:
=== "Bugs"
If you find a bug, please let us know by posting into the [v3 Alpha Feedback](https://discord.gg/3mgVyGua) channel on Discord.
If you find a bug, please let us know by posting into the [v3 Alpha Feedback](https://discord.gg/Vgff2p8gsy) channel on Discord.
- The post should clearly state what the bug is and have a simple reproducible example. If the docs are unclear what *should* happen, please include that in the post.
- The post should be given the `Bug` tag.
@@ -24,17 +24,17 @@ posts before creating new ones. Here are the different ways to provide feedback:
If you have a fix for a bug or an update for documentation, please do the following:
- Open a pull request on the [Wails repository](https://github.com/wailsapp/wails). The title of the PR should start with `[v3 alpha]`.
- Create a post in the [v3 Alpha Feedback](https://discord.gg/3mgVyGua) channel.
- Create a post in the [v3 Alpha Feedback](https://discord.gg/Vgff2p8gsy) channel.
- The post should be given the `PR` tag.
- Please include a link to the PR in your post.
=== "Suggestions"
If you have a suggestion, please let us know by posting into the [v3 Alpha Feedback](https://discord.gg/3mgVyGua) channel on Discord:
If you have a suggestion, please let us know by posting into the [v3 Alpha Feedback](https://discord.gg/Vgff2p8gsy) channel on Discord:
- The post should be given the `Suggestion` tag.
Please feel free to reach out to us on [Discord](https://discord.gg/3mgVyGua) if you have any questions.
Please feel free to reach out to us on [Discord](https://discord.gg/Vgff2p8gsy) if you have any questions.
=== "Upvoting"
@@ -1,149 +0,0 @@
# Enums
In Go, an enum (enumeration) is a user-defined type that consists of a set of named constants called enumerators. Enums
are useful for representing a fixed set of values that a variable can take.
To define an enum in Go, you can use a type declaration with a list of constant values. Here's an example:
```go
type Title string
const (
Mr Title = "Mr"
Mrs Title = "Mrs"
Ms Title = "Ms"
)
```
In this example, we define an enum type called `Title` using the `type` keyword. We then declare a set of constants
(`Mr`, `Mrs`, `Ms`) of type `Title` using the `const` keyword.
## Using Enums in Bound Structs
Let's extend our previous example to use the `Title` enum in the `Person` struct:
```go
package main
import (
"github.com/wailsapp/wails/v3/pkg/application"
"log"
)
// Title is a title
type Title string
const (
Mr Title = "Mr"
Mrs Title = "Mrs"
Ms Title = "Ms"
)
// Person is a person
type Person struct {
// Name of the person
Name string
// Title of the person
Title Title
}
type GreetService struct{}
func (g *GreetService) Greet(person Person) string {
return "Hello " + string(person.Title) + " " + person.Name
}
func main() {
app := application.New(application.Options{
Bind: []any{
&GreetService{},
},
})
// ....
app.NewWebviewWindow()
err := app.Run()
if err != nil {
log.Fatal(err)
}
}
```
In this updated example, we add a `Title` field of type `Title` to the `Person` struct. The `Greet` method now includes the `Title` in the greeting message.
When we run the bindings generator, it will process the enum and generate the corresponding JavaScript or TypeScript code.
## Generating Bindings with Enums
After adding the `Title` enum to our example, let's generate the bindings using the following command:
```bash
% wails3 generate bindings
```
The output should display information about the processed package, struct, method, enum, and model:
```bash
INFO Processed: 1 Package, 1 Struct, 1 Method, 1 Enum, 1 Model in 1.044166ms.
INFO Output directory: /Users/lea/GolandProjects/tempdocs/binding/frontend/bindings
```
If we look in the `frontend/bindings` directory, we should see a generated `models.js` file that includes the enum definition:
```javascript
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Ă‚ MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @readonly
* @enum {string}
*/
export const Title = {
Mr: "Mr",
Mrs: "Mrs",
Ms: "Ms",
};
/**
* Person defines a person
*/
export class Person {
/**
* Creates a new Person instance.
* @param {Partial<Person>} [source = {}] - The source object to create the Person.
*/
constructor(source = {}) {
if (!("Name" in source)) {
/**
* Name of the person
* @member
* @type {string}
*/
this["Name"] = "";
}
if (!("Title" in source)) {
/**
* Title of the person
* @member
* @type {Title}
*/
this["Title"] = null;
}
Object.assign(this, source);
}
/**
* Creates a new Person instance from a string or object.
* @param {string|object} source - The source data to create a Person instance from.
* @returns {Person} A new Person instance.
*/
static createFrom(source) {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new Person(parsedSource);
}
}
```
The generated `models.js` file includes the `Title` enum definition, which is exported as a read-only object with the enum values as properties. The `Person` class also includes a `Title` property of type `Title`.
You can now use the generated enum and class in your frontend code when interacting with the bound `GreetService` struct.
@@ -1,14 +0,0 @@
# Bindings Generator Guide
Welcome to the Wails v3 Bindings Generator Guide!
One of the key features of Wails is the ability to seamlessly integrate backend Go code with the frontend, enabling
efficient communication between the two layers. This can be done manually by sending messages between the frontend and
backend, but this can be cumbersome and error-prone, especially when dealing with complex data types.
The bindings generator in Wails v3 simplifies this process by automatically generating JavaScript or TypeScript
functions and models that reflect the methods and data structures defined in your Go code. This means you can write
your backend logic in Go and easily expose it to the frontend without the need for manual binding or complex integration.
This guide is designed to help you understand and utilise this powerful binding tool.

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