2021-09-08 08:58:58 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
)
|
|
|
|
|
|
|
|
// App struct
|
|
|
|
type App struct {
|
2021-09-09 22:13:06 +08:00
|
|
|
ctx context.Context
|
2021-09-08 08:58:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewApp creates a new App application struct
|
2021-09-09 22:13:06 +08:00
|
|
|
// NewApp 创建一个新的 App 应用程序
|
2021-09-08 08:58:58 +08:00
|
|
|
func NewApp() *App {
|
|
|
|
return &App{}
|
|
|
|
}
|
|
|
|
|
|
|
|
// startup is called at application startup
|
2021-09-09 22:13:06 +08:00
|
|
|
// startup 在应用程序启动时调用
|
2021-09-23 01:30:36 +08:00
|
|
|
func (a *App) startup(ctx context.Context) {
|
2021-09-08 08:58:58 +08:00
|
|
|
// Perform your setup here
|
2021-09-09 22:13:06 +08:00
|
|
|
// 在这里执行初始化设置
|
2021-09-23 01:30:36 +08:00
|
|
|
a.ctx = ctx
|
|
|
|
}
|
|
|
|
|
|
|
|
// domReady is called after the front-end dom has been loaded
|
|
|
|
// domReady 在前端Dom加载完毕后调用
|
2021-11-14 03:03:49 +08:00
|
|
|
func (a *App) domReady(ctx context.Context) {
|
2021-09-23 01:30:36 +08:00
|
|
|
// Add your action here
|
|
|
|
// 在这里添加你的操作
|
2021-09-08 08:58:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// shutdown is called at application termination
|
2021-09-09 05:17:10 +08:00
|
|
|
// 在应用程序终止时被调用
|
2021-09-23 01:30:36 +08:00
|
|
|
func (a *App) shutdown(ctx context.Context) {
|
2021-09-08 08:58:58 +08:00
|
|
|
// Perform your teardown here
|
2021-09-09 22:13:06 +08:00
|
|
|
// 在此处做一些资源释放的操作
|
2021-09-08 08:58:58 +08:00
|
|
|
}
|