5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-04 23:59:52 +08:00
wails/v3/pkg/application/events_common_darwin.go
Lea Anthony 1195464acb Improve window teardown on termination
This commit adds a robust teardown process for windows on application shutdown. It introduces a field to track the destruction state of each window and checks such before performing window operations. Also, it enhances the destroy functions within application for thorough clean up. Finally, redundant event handlers related to application termination were removed while fixing file generating challenge in go tasks.
2024-01-09 07:45:56 +11:00

22 lines
620 B
Go

//go:build darwin
package application
import "github.com/wailsapp/wails/v3/pkg/events"
var commonApplicationEventMap = map[events.ApplicationEventType]events.ApplicationEventType{
events.Mac.ApplicationDidFinishLaunching: events.Common.ApplicationStarted,
events.Mac.ApplicationDidChangeTheme: events.Common.ThemeChanged,
}
func (m *macosApp) setupCommonEvents() {
for sourceEvent, targetEvent := range commonApplicationEventMap {
sourceEvent := sourceEvent
targetEvent := targetEvent
m.parent.On(sourceEvent, func(event *Event) {
event.Id = uint(targetEvent)
applicationEvents <- event
})
}
}