github.com/AlpineAIO/wails/v2@v2.0.0-beta.32.0.20240505041856-1047a8fa5fef/internal/app/app.go (about) 1 package app 2 3 import ( 4 "context" 5 6 "github.com/AlpineAIO/wails/v2/internal/frontend" 7 "github.com/AlpineAIO/wails/v2/internal/logger" 8 "github.com/AlpineAIO/wails/v2/internal/menumanager" 9 "github.com/AlpineAIO/wails/v2/pkg/menu" 10 "github.com/AlpineAIO/wails/v2/pkg/options" 11 ) 12 13 // App defines a Wails application structure 14 type App struct { 15 frontend frontend.Frontend 16 logger *logger.Logger 17 options *options.App 18 19 menuManager *menumanager.Manager 20 21 // Indicates if the app is in debug mode 22 debug bool 23 24 // Indicates if the devtools is enabled 25 devtoolsEnabled bool 26 27 // OnStartup/OnShutdown 28 startupCallback func(ctx context.Context) 29 shutdownCallback func(ctx context.Context) 30 ctx context.Context 31 } 32 33 // Shutdown the application 34 func (a *App) Shutdown() { 35 if a.frontend != nil { 36 a.frontend.Quit() 37 } 38 } 39 40 // SetApplicationMenu sets the application menu 41 func (a *App) SetApplicationMenu(menu *menu.Menu) { 42 if a.frontend != nil { 43 a.frontend.MenuSetApplicationMenu(menu) 44 } 45 }