This repository has been archived by the owner on Feb 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
/
options.go
56 lines (45 loc) · 1.91 KB
/
options.go
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
package bootstrap
import (
"os"
"github.com/asticode/go-astikit"
"github.com/asticode/go-astilectron"
)
// Options represents options
type Options struct {
Adapter AstilectronAdapter
Asset Asset
AssetDir AssetDir
AstilectronOptions astilectron.Options
Debug bool
IgnoredSignals []os.Signal
Logger astikit.StdLogger
MenuOptions []*astilectron.MenuItemOptions
MenuOptionsFunc func(*astilectron.Astilectron) []*astilectron.MenuItemOptions
OnWait OnWait
ResourcesPath string
RestoreAssets RestoreAssets
TrayMenuOptions []*astilectron.MenuItemOptions
TrayOptions *astilectron.TrayOptions
Windows []*Window
}
// Options to setup and create a new window
type Window struct {
Adapter WindowAdapter
Homepage string
MessageHandler MessageHandler
Options *astilectron.WindowOptions
}
// AstilectronAdapter is a function that adapts the astilectron instance
type AstilectronAdapter func(w *astilectron.Astilectron)
// Asset is a function that retrieves an asset content namely the go-bindata's Asset method
type Asset func(name string) ([]byte, error)
// AssetDir is a function that retrieves an asset dir namely the go-bindata's AssetDir method
type AssetDir func(name string) ([]string, error)
// MessageHandler is a functions that handles messages
type MessageHandler func(w *astilectron.Window, m MessageIn) (payload interface{}, err error)
// OnWait is a function that executes custom actions before waiting
type OnWait func(a *astilectron.Astilectron, w []*astilectron.Window, m *astilectron.Menu, t *astilectron.Tray, tm *astilectron.Menu) error
// RestoreAssets is a function that restores assets namely the go-bindata's RestoreAssets method
type RestoreAssets func(dir, name string) error
// WindowAdapter is a function that adapts a window
type WindowAdapter func(w *astilectron.Window)