mirror of
https://github.com/misitebao/wails-template-vue
synced 2025-02-24 05:42:16 +08:00
40 lines
786 B
Go
40 lines
786 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/wailsapp/wails/v2/pkg/runtime"
|
|
)
|
|
|
|
// App struct
|
|
type App struct {
|
|
ctx context.Context
|
|
}
|
|
|
|
// NewApp creates a new App application struct
|
|
// NewApp 创建一个新的 App 应用程序
|
|
func NewApp() *App {
|
|
return &App{}
|
|
}
|
|
|
|
// startup is called at application startup
|
|
// startup 在应用程序启动时调用
|
|
func (b *App) startup(ctx context.Context) {
|
|
// Perform your setup here
|
|
// 在这里执行初始化设置
|
|
b.ctx = ctx
|
|
}
|
|
|
|
// shutdown is called at application termination
|
|
// 在应用程序终止时被调用
|
|
func (b *App) shutdown(ctx context.Context) {
|
|
// Perform your teardown here
|
|
// 在此处做一些资源释放的操作
|
|
}
|
|
|
|
// Quit Exit the application
|
|
// Quit 退出应用
|
|
func (b *App) Quit() {
|
|
runtime.Quit(b.ctx)
|
|
}
|