5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 21:29:09 +08:00

basic implement

This commit is contained in:
ironpark 2021-12-04 04:55:36 +09:00
parent b7a4aba5f3
commit fda3323386
4 changed files with 13 additions and 3 deletions

View File

@ -206,6 +206,9 @@ func (f *Frontend) WindowSetRGBA(col *options.RGBA) {
}
func (f *Frontend) Quit() {
if f.frontendOptions.OnBeforeClose != nil && f.frontendOptions.OnBeforeClose(f.ctx) {
return
}
f.mainWindow.Quit()
}

View File

@ -208,6 +208,9 @@ func (f *Frontend) WindowSetRGBA(col *options.RGBA) {
}
func (f *Frontend) Quit() {
if f.frontendOptions.OnBeforeClose != nil && f.frontendOptions.OnBeforeClose(f.ctx) {
return
}
f.mainWindow.Quit()
}

View File

@ -261,6 +261,9 @@ func (f *Frontend) WindowSetRGBA(col *options.RGBA) {
}
func (f *Frontend) Quit() {
if f.frontendOptions.OnBeforeClose != nil && f.frontendOptions.OnBeforeClose(f.ctx) {
return
}
// Exit must be called on the Main-Thread. It calls PostQuitMessage which sends the WM_QUIT message to the thread's
// message queue and our message queue runs on the Main-Thread.
f.mainWindow.Invoke(winc.Exit)

View File

@ -45,9 +45,10 @@ type App struct {
Menu *menu.Menu
Logger logger.Logger `json:"-"`
LogLevel logger.LogLevel
OnStartup func(ctx context.Context) `json:"-"`
OnDomReady func(ctx context.Context) `json:"-"`
OnShutdown func(ctx context.Context) `json:"-"`
OnStartup func(ctx context.Context) `json:"-"`
OnDomReady func(ctx context.Context) `json:"-"`
OnShutdown func(ctx context.Context) `json:"-"`
OnBeforeClose func(ctx context.Context) (prevent bool) `json:"-"`
Bind []interface{}
WindowStartState WindowStartState