mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-07 07:02:46 +08:00

* Add some clarifying comments * Remove special handling of window parameters * Improve internal method exclusion * Add test for internal method exclusion * Remove useless blank field from app options This is a leftover from an older version of the static analyser. It should have been removed long ago. * Remove redundant godebug setting gotypesalias=1 is the default starting with go1.23 * Use new range for syntax to simplify code * Remove generator dependency on github.com/samber/lo * Ensure generator testing tasks do not use the test cache * Rename cyclic types test * Test for cyclic imports * Fix import cycle between model files * Sort class aliases after their aliased class * Test class aliases * Fix length of default value for array types * Test array initialization * Add changelog * Update changelog * Fix contrived marking technique in model sorting algorithm * Update binding example * Update test data --------- Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
62 lines
982 B
Go
62 lines
982 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
_ "embed"
|
|
"log"
|
|
"net/http"
|
|
|
|
"github.com/wailsapp/wails/v3/pkg/application"
|
|
)
|
|
|
|
// GreetService is great
|
|
type GreetService struct {
|
|
SomeVariable int
|
|
lowerCase string
|
|
}
|
|
|
|
// Greet someone
|
|
func (*GreetService) Greet(name string) string {
|
|
return "Hello " + name
|
|
}
|
|
|
|
// Debugging name
|
|
func (*GreetService) ServiceName() string {
|
|
return "GreetService"
|
|
}
|
|
|
|
// Lifecycle
|
|
func (*GreetService) ServiceStartup(context.Context, application.ServiceOptions) error {
|
|
return nil
|
|
}
|
|
|
|
// Lifecycle
|
|
func (*GreetService) ServiceShutdown() error {
|
|
return nil
|
|
}
|
|
|
|
// Serve some routes
|
|
func (*GreetService) ServeHTTP(http.ResponseWriter, *http.Request) {
|
|
}
|
|
|
|
func NewGreetService() application.Service {
|
|
return application.NewService(&GreetService{})
|
|
}
|
|
|
|
func main() {
|
|
app := application.New(application.Options{
|
|
Services: []application.Service{
|
|
NewGreetService(),
|
|
},
|
|
})
|
|
|
|
app.NewWebviewWindow()
|
|
|
|
err := app.Run()
|
|
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
}
|