Documentation ¶
Index ¶
- Constants
- func SendMessage(ctx context.Context, w *astilectron.Window, name string, payload interface{}, ...)
- type AssetDirFunc
- type AssetFunc
- type CallbackMessage
- type DefaultMessageListener
- type Electron
- type MessageHandler
- type MessageIn
- type MessageListener
- type MessageOut
- type Options
- type PreferencesUpdatedHandler
- type PreferencesUpdatedHandlerConfig
- type RestoreAssetsFunc
Constants ¶
const (
// OctantCmdPreferences is a command for showing preferences
OctantCmdPreferences = "octant.cmd.preferences"
)
Variables ¶
This section is empty.
Functions ¶
func SendMessage ¶
func SendMessage(ctx context.Context, w *astilectron.Window, name string, payload interface{}, cs ...CallbackMessage)
SendMessage sends a message
Types ¶
type AssetDirFunc ¶
AssetDirFunc returns the files in an asset directory.
type CallbackMessage ¶
type CallbackMessage func(m *MessageIn)
CallbackMessage represents a bootstrap message callback
type DefaultMessageListener ¶
type DefaultMessageListener struct {
// contains filtered or unexported fields
}
DefaultMessageListener listens for messages.
func NewMessageListener ¶
func NewMessageListener() *DefaultMessageListener
NewMessageListener creates an instance of DefaultMessageListener.
func (*DefaultMessageListener) Handle ¶
func (m *DefaultMessageListener) Handle(ctx context.Context, _ *astilectron.Window, message MessageIn) (interface{}, error)
Handle handles a message.
func (*DefaultMessageListener) Register ¶
func (m *DefaultMessageListener) Register(handlers ...MessageHandler)
Register registers a handler.
func (*DefaultMessageListener) Unregister ¶
func (m *DefaultMessageListener) Unregister(key string)
Unregister unregisters a listener key.
type Electron ¶
type Electron struct {
// contains filtered or unexported fields
}
Electron manages the electron app.
type MessageHandler ¶
type MessageHandler interface { // Key is the key for this handler. Key() string // Handle processes the message. Handle(ctx context.Context, in json.RawMessage) (interface{}, error) }
MessageHandler handles a message.
type MessageIn ¶
type MessageIn struct { Name string `json:"name"` Payload json.RawMessage `json:"payload,omitempty"` }
MessageIn is an incoming message.
type MessageListener ¶
type MessageListener interface { // Handle handles a message using one of the registered message handlers. Handle(ctx context.Context, w *astilectron.Window, message MessageIn) (interface{}, error) // Register registers a message handler. Register(handlers ...MessageHandler) // Unregister unregisters a message handler by key. Unregister(key string) }
MessageListener listens for messages.
type MessageOut ¶
type MessageOut struct { Name string `json:"name"` Payload interface{} `json:"payload,omitempty"` }
MessageOut is an outgoing message.
func CreateMessageOut ¶
func CreateMessageOut(name string, payload interface{}) *MessageOut
CreateMessageOut creates an outgoing message.
type Options ¶
type Options struct { // AppName is the name of the application. AppName string // Asset is asset loader. Asset AssetFunc // AssetDir is the asset directory lister. AssetDir AssetDirFunc // RestoreAssets is the asset restorer. RestoreAssets RestoreAssetsFunc // VersionAstilectron is the astilectron version. VersionAstilectron string // VersionElectron is the electron version. VersionElectron string }
Options are options for configuring the electron app.
type PreferencesUpdatedHandler ¶
type PreferencesUpdatedHandler struct {
// contains filtered or unexported fields
}
PreferencesUpdatedHandler is a handler for updated preferences.
func NewPreferencesUpdatedHandler ¶
func NewPreferencesUpdatedHandler(config PreferencesUpdatedHandlerConfig) *PreferencesUpdatedHandler
NewPreferencesUpdatedHandler creates an instances of PreferencesUpdatedHandler.
func (PreferencesUpdatedHandler) Handle ¶
func (p PreferencesUpdatedHandler) Handle(ctx context.Context, in json.RawMessage) (interface{}, error)
Handle handles an update request.
func (PreferencesUpdatedHandler) Key ¶
func (p PreferencesUpdatedHandler) Key() string
Key returns the key for this handler.
type PreferencesUpdatedHandlerConfig ¶
type PreferencesUpdatedHandlerConfig interface {
DataDirectory() string
}
PreferencesUpdatedHandlerConfig is configuration for PreferencesUpdatedHandler.
type RestoreAssetsFunc ¶
RestoreAssetsFunc restores assets.