mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-09 18:19:36 +08:00

This commit includes the addition of common events for the Linux platform. Refactored and standardized the method receivers for the application from 'm' to 'l'. Also, the application startup events in the window example have been updated according to the new naming scheme.
22 lines
601 B
Go
22 lines
601 B
Go
//go:build linux
|
|
|
|
package application
|
|
|
|
import "github.com/wailsapp/wails/v3/pkg/events"
|
|
|
|
var commonApplicationEventMap = map[events.ApplicationEventType]events.ApplicationEventType{
|
|
events.Linux.ApplicationStartup: events.Common.ApplicationStarted,
|
|
events.Linux.SystemThemeChanged: events.Common.ThemeChanged,
|
|
}
|
|
|
|
func (l *linuxApp) setupCommonEvents() {
|
|
for sourceEvent, targetEvent := range commonApplicationEventMap {
|
|
sourceEvent := sourceEvent
|
|
targetEvent := targetEvent
|
|
l.parent.On(sourceEvent, func(event *Event) {
|
|
event.Id = uint(targetEvent)
|
|
applicationEvents <- event
|
|
})
|
|
}
|
|
}
|