Description
I have an issue when trying to use methods of structs in the frontend.
Let's say we have this main.go
package main
import (
"github.com/leaanthony/mewn"
"github.com/wailsapp/wails"
)
func basic() string {
return "Hello World!"
}
func basic2() string {
return "Hello World!"
}
type Testio struct {
test2 int
}
func (t *Testio) Testio1() {
}
func (t *Testio) Testio2() {
}
func main() {
js := mewn.String("./frontend/dist/app.js")
css := mewn.String("./frontend/dist/app.css")
app := wails.CreateApp(&wails.AppConfig{
Width: 1024,
Height: 768,
Title: "testio2",
JS: js,
CSS: css,
Colour: "#131313",
})
app.Bind(basic)
app.Bind(basic2)
app.Bind(&Testio{})
app.Run()
}
while serving, I try to check the methods are working via the console and I get:
VM1315:1 Uncaught TypeError: window.backend.Testio.Testio1 is not a function
at <anonymous>:1:23
this is the log of when wails serve starts
INFO[0000] [Bind] Binding Go Functions/Methods
INFO[0000] [Bind] Bound Function: main.basic()
INFO[0000] [Bind] Bound Function: main.basic2()
INFO[0000] [Bind] Bound Method: main.Testio.Testio1()
INFO[0000] [Bind] Bound Method: main.Testio.Testio2()
if then I remove the second method func (t *Testio) Testio2()
the first method works fine (see screenshots)
To Reproduce
Steps to reproduce the behaviour:
Expected behaviour
Having all methods of a binded struct exported
Screenshots


System Details
| Name | Value |
| ----- | ----- |
| Wails Version | v0.17.15-pre |
| Go Version | go1.13 |
| Platform | linux |
| Arch | amd64 |
| GO111MODULE | on |
| GCC | 8.3.0 |
| Npm | v12.10.0 |
| Node | 6.10.3 |
I've identified the issue and got a fix. However there appears to be another related bug that needs to be fixed first. I'M ON IT! :joy:
Fixed by #245 - in develop.
~I am afraid it didn't fix it :/~
it works fine!
for future reference
replace github.com/wailsapp/wails v0.17.15-pre => /path/to/wails/
:+1:
Most helpful comment
I've identified the issue and got a fix. However there appears to be another related bug that needs to be fixed first. I'M ON IT! :joy: