Repository navigation
Expand file tree
/
Copy pathevents.go
More file actions
65 lines (61 loc) · 3.19 KB
/
Copy pathevents.go
File metadata and controls
65 lines (61 loc) · 3.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package main
import (
"github.com/wailsapp/wails/v3/pkg/application"
"unidoc-pdf-debugger/internal/filewatch"
)
// Custom event names shared by the Go side and the frontend. Each one is
// registered below, so the binding generator emits a typed constant for it in
// frontend/bindings/events and Wails checks the data type on every emit.
const (
eventDocumentLoadStart = "document:load-start"
eventDocumentOpened = "document:opened"
eventDocumentError = "document:error"
eventDocumentDiskStatus = "document:disk-status"
eventDocumentBatchStart = "document:batch-start"
eventDocumentBatchComplete = "document:batch-complete"
eventDocumentBatchCancel = "document:batch-cancel"
eventDocumentCloseActive = "document:close-active"
eventDocumentReloadActive = "document:reload-active"
eventDocumentCompareActive = "document:compare-active"
eventNavigateBack = "navigate:back"
eventNavigateForward = "navigate:forward"
eventNavigateGoToPage = "navigate:goToPage"
eventNavigateStateChanged = "navigate:state-changed"
eventPaletteOpen = "palette:open"
eventRowMenuAction = "row-menu:action"
eventTabNext = "tab:next"
eventTabPrev = "tab:prev"
eventUpdateCheckRequested = "update:check-requested"
eventSplashDismiss = "splash:dismiss"
eventSplashDismissed = "splash:dismissed"
eventSplashTimeout = "splash:timeout"
eventAboutOpen = "about:open"
)
// init registers every app event with the data type its emitters send: Void for
// events sent with nil, the exact Go type otherwise. The registration calls use
// constant names so the binding generator can discover them.
func init() {
application.RegisterEvent[map[string]any](eventDocumentLoadStart)
application.RegisterEvent[map[string]any](eventDocumentOpened)
application.RegisterEvent[map[string]any](eventDocumentError)
application.RegisterEvent[filewatch.Event](eventDocumentDiskStatus)
application.RegisterEvent[map[string]any](eventDocumentBatchStart)
application.RegisterEvent[application.Void](eventDocumentBatchComplete)
application.RegisterEvent[application.Void](eventDocumentBatchCancel)
application.RegisterEvent[application.Void](eventDocumentCloseActive)
application.RegisterEvent[application.Void](eventDocumentReloadActive)
application.RegisterEvent[application.Void](eventDocumentCompareActive)
application.RegisterEvent[application.Void](eventNavigateBack)
application.RegisterEvent[application.Void](eventNavigateForward)
application.RegisterEvent[application.Void](eventNavigateGoToPage)
application.RegisterEvent[map[string]any](eventNavigateStateChanged)
application.RegisterEvent[application.Void](eventPaletteOpen)
application.RegisterEvent[RowMenuAction](eventRowMenuAction)
application.RegisterEvent[application.Void](eventTabNext)
application.RegisterEvent[application.Void](eventTabPrev)
application.RegisterEvent[application.Void](eventUpdateCheckRequested)
application.RegisterEvent[application.Void](eventSplashDismiss)
application.RegisterEvent[application.Void](eventSplashDismissed)
application.RegisterEvent[application.Void](eventSplashTimeout)
application.RegisterEvent[string](eventAboutOpen)
}