mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 03:20:09 +08:00

* Application refactor * [windows] refactor out main loop. Create new application struct. Refactor assethandler/assetserver signatures. * Refactor darwin app * Refactor app for linux * Update v2/internal/frontend/assetserver/assethandler.go Co-authored-by: stffabi <stffabi@users.noreply.github.com> * Update v2/internal/frontend/assetserver/assethandler.go Co-authored-by: stffabi <stffabi@users.noreply.github.com> * Update v2/internal/frontend/assetserver/assetserver.go Co-authored-by: stffabi <stffabi@users.noreply.github.com> * Update v2/internal/frontend/assetserver/assetserver.go Co-authored-by: stffabi <stffabi@users.noreply.github.com> Co-authored-by: stffabi <stffabi@users.noreply.github.com>
42 lines
928 B
Go
42 lines
928 B
Go
package app
|
|
|
|
import (
|
|
"context"
|
|
"github.com/wailsapp/wails/v2/internal/frontend"
|
|
"github.com/wailsapp/wails/v2/internal/logger"
|
|
"github.com/wailsapp/wails/v2/internal/menumanager"
|
|
"github.com/wailsapp/wails/v2/pkg/menu"
|
|
"github.com/wailsapp/wails/v2/pkg/options"
|
|
)
|
|
|
|
// App defines a Wails application structure
|
|
type App struct {
|
|
frontend frontend.Frontend
|
|
logger *logger.Logger
|
|
options *options.App
|
|
|
|
menuManager *menumanager.Manager
|
|
|
|
// Indicates if the app is in debug mode
|
|
debug bool
|
|
|
|
// OnStartup/OnShutdown
|
|
startupCallback func(ctx context.Context)
|
|
shutdownCallback func(ctx context.Context)
|
|
ctx context.Context
|
|
}
|
|
|
|
// Shutdown the application
|
|
func (a *App) Shutdown() {
|
|
if a.frontend != nil {
|
|
a.frontend.Quit()
|
|
}
|
|
}
|
|
|
|
// SetApplicationMenu sets the application menu
|
|
func (a *App) SetApplicationMenu(menu *menu.Menu) {
|
|
if a.frontend != nil {
|
|
a.frontend.MenuSetApplicationMenu(menu)
|
|
}
|
|
}
|