mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 14:45:49 +01:00
[v3] Improve OnShutdown (#3190)
* [v3] Improve OnShutdown * add change log
This commit is contained in:
parent
f759162fd1
commit
3cd26a2220
3 changed files with 8 additions and 6 deletions
|
|
@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- [linux] add onKeyPress logic to convert linux keypress into an accelerator @[Atterpac](https://github.com/Atterpac) in[#3022](https://github.com/wailsapp/wails/pull/3022])
|
||||
- [linux] add task `run:linux` by [@marcus-crane](https://github.com/marcus-crane) in [#3146](https://github.com/wailsapp/wails/pull/3146)
|
||||
- export `SetIcon` method by @almas1992 in [PR](https://github.com/wailsapp/wails/pull/3147)
|
||||
- Improve `OnShutdown` by @almas1992 in [PR](https://github.com/wailsapp/wails/pull/3189)
|
||||
|
||||
### Fixed
|
||||
|
||||
|
|
|
|||
|
|
@ -291,10 +291,6 @@ type App struct {
|
|||
// Keybindings
|
||||
keyBindings map[string]func(window *WebviewWindow)
|
||||
|
||||
// OnShutdown is called when the application is about to quit.
|
||||
// This is useful for cleanup tasks.
|
||||
// The shutdown process blocks until this function returns
|
||||
OnShutdown func()
|
||||
performingShutdown bool
|
||||
}
|
||||
|
||||
|
|
@ -609,8 +605,8 @@ func (a *App) Quit() {
|
|||
return
|
||||
}
|
||||
a.performingShutdown = true
|
||||
if a.OnShutdown != nil {
|
||||
a.OnShutdown()
|
||||
if a.options.OnShutdown != nil {
|
||||
a.options.OnShutdown()
|
||||
}
|
||||
InvokeSync(func() {
|
||||
a.windowsLock.RLock()
|
||||
|
|
|
|||
|
|
@ -51,6 +51,11 @@ type Options struct {
|
|||
|
||||
// KeyBindings is a map of key bindings to functions
|
||||
KeyBindings map[string]func(window *WebviewWindow)
|
||||
|
||||
// OnShutdown is called when the application is about to quit.
|
||||
// This is useful for cleanup tasks.
|
||||
// The shutdown process blocks until this function returns
|
||||
OnShutdown func()
|
||||
}
|
||||
|
||||
// AssetOptions defines the configuration of the AssetServer.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue