github.com/secoba/wails/v2@v2.6.4/pkg/templates/generate/plain/app.go (about) 1 package main 2 3 import ( 4 "context" 5 "fmt" 6 ) 7 8 // App struct 9 type App struct { 10 ctx context.Context 11 } 12 13 // NewApp creates a new App application struct 14 func NewApp() *App { 15 return &App{} 16 } 17 18 // startup is called at application startup 19 func (a *App) startup(ctx context.Context) { 20 // Perform your setup here 21 a.ctx = ctx 22 } 23 24 // domReady is called after front-end resources have been loaded 25 func (a App) domReady(ctx context.Context) { 26 // Add your action here 27 } 28 29 // beforeClose is called when the application is about to quit, 30 // either by clicking the window close button or calling runtime.Quit. 31 // Returning true will cause the application to continue, false will continue shutdown as normal. 32 func (a *App) beforeClose(ctx context.Context) (prevent bool) { 33 return false 34 } 35 36 // shutdown is called at application termination 37 func (a *App) shutdown(ctx context.Context) { 38 // Perform your teardown here 39 } 40 41 // Greet returns a greeting for the given name 42 func (a *App) Greet(name string) string { 43 return fmt.Sprintf("Hello %s, It's show time!", name) 44 }