Replies: 2 comments 4 replies
-
Answer in https://discord.com/channels/1042734330029547630/1061396491769479300/1217547615537729688 |
Beta Was this translation helpful? Give feedback.
2 replies
-
@KiddoV you can use Your struct package test
type TestStruct struct {
Field1 string
Field2 int
}
func (t *TestStruct) SomeMethod() error {
fmt.Println("TestStruct.SomeMethod() called!")
return nil
}
func NewTestStruc() *TestStruct {
return &TestStruct{}
} Then on your package main
import (
"yourpkg/test"
)
type App struct {
ctx context.Context
TestStruct *TestStruct
}
func NewApp() *App {
app := &App{
TestStruct: test.NewTestStruc(),
}
return app
} Then on you func main() {
// ....
app := NewApp()
// Create application with options
err := wails.Run(&options.App{
// ....
Bind: []interface{}{
app,
app.TestStruct, // Your Struct
},
})
} This should generate
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Why is my generated JS class doesn't come with my struct method in this case?
I have a every basic struct:
I have a function to init this struct in the main
app
struct:Now in the frontend I call the function to init the struct:
However I don't see any struct methods created in the
models.ts
with classtest
in my frontend.Is it even possible for Wails?
Beta Was this translation helpful? Give feedback.
All reactions