wails-template/app.go

36 lines
609 B
Go
Raw Permalink Normal View History

2025-02-03 16:09:45 +01:00
package main
import (
"context"
"fmt"
2025-02-24 12:55:12 +01:00
"github.com/gen2brain/beeep"
2025-02-03 16:09:45 +01:00
)
// App struct
type App struct {
ctx context.Context
}
// NewApp creates a new App application struct
func NewApp() *App {
2025-02-24 12:55:12 +01:00
2025-02-03 16:09:45 +01:00
return &App{}
}
// startup is called when the app starts. The context is saved
// so we can call the runtime methods
func (a *App) startup(ctx context.Context) {
a.ctx = ctx
2025-02-24 12:55:12 +01:00
err := beeep.Notify("Hello", "World", "")
if err != nil {
fmt.Println(err)
}
2025-02-03 16:09:45 +01:00
}
// Greet returns a greeting for the given name
func (a *App) Greet(name string) string {
return fmt.Sprintf("Hello %s, It's show time!", name)
}