39 lines
798 B
Go
39 lines
798 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"yellowjacket/backend"
|
|
)
|
|
|
|
// App struct
|
|
type App struct {
|
|
ctx context.Context
|
|
config *backend.Config
|
|
}
|
|
|
|
// NewApp creates a new App application struct
|
|
func NewApp() *App {
|
|
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
|
|
|
|
conf, err := backend.GetConfig()
|
|
if err != nil {
|
|
panic(fmt.Errorf("could not get config: %w", err))
|
|
}
|
|
a.config = conf
|
|
}
|
|
|
|
// Greet returns a greeting for the given name
|
|
func (a *App) Greet(name string) string {
|
|
return fmt.Sprintf("Hello %s, here's your song!", name)
|
|
}
|
|
|
|
//trying to make a function
|
|
//func (a *App) dirPicker(ctx context.Context, dialogOptions OpenDialogOptions)(string, error){}
|