-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathapp.go
More file actions
52 lines (42 loc) · 1.03 KB
/
app.go
File metadata and controls
52 lines (42 loc) · 1.03 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
package main
import (
"context"
"fmt"
"github.com/wailsapp/wails/v2/pkg/runtime"
)
// App struct
type App struct {
ctx context.Context
}
// NewApp creates a new App application struct
func NewApp() *App {
return &App{}
}
// startup is called at application startup
func (b *App) startup(ctx context.Context) {
// Perform your setup here
b.ctx = ctx
}
// domReady is called after the front-end dom has been loaded
func (b *App) domReady(ctx context.Context) {
// Add your action here
}
// shutdown is called at application termination
func (b *App) shutdown(ctx context.Context) {
// Perform your teardown here
}
// Greet returns a greeting for the given name
func (b *App) Greet(name string) string {
return fmt.Sprintf("Hello %s, It's show time!", name)
}
// Shows a Dialog
func (b *App) ShowDialog() {
_, err := runtime.MessageDialog(b.ctx, runtime.MessageDialogOptions{
Type: runtime.InfoDialog,
Title: "Native Dialog from Go",
Message: "This is a Native Dialog send from Go.",
})
if err != nil {
panic(err)
}
}