-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelper.go
More file actions
33 lines (28 loc) · 928 Bytes
/
helper.go
File metadata and controls
33 lines (28 loc) · 928 Bytes
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
package main
import (
"fmt"
"github.com/404errorg6/share-all/internal/config"
"time"
"github.com/wailsapp/wails/v3/pkg/application"
"github.com/wailsapp/wails/v3/pkg/events"
)
// Register events
func StartEventSystem(app *application.App, win *application.WebviewWindow) {
application.RegisterEvent[config.ServerDiscoveryInfo]("client:discover-servers")
application.RegisterEvent[config.TransferInfo]("transfers:ongoing")
application.RegisterEvent[config.TransferInfo]("transfers:completed")
win.OnWindowEvent(events.Common.WindowFilesDropped, func(event *application.WindowEvent) {
files := event.Context().DroppedFiles()
app.Event.Emit("item-dropped", files)
},
)
// Logs events
go func() {
time.Sleep(2 * time.Second) //Wait for frontend start before sending logs
for log := range config.LogsCh {
log = fmt.Sprintf("[LOGS]: %v\n", log)
fmt.Print(log)
app.Event.Emit("Logs", log)
}
}()
}