Documentation ¶
Index ¶
- Constants
- Variables
- func AstilectronDownloadSrc(versionAstilectron string) string
- func DefaultExecuter(a *Astilectron, cmd *exec.Cmd) (err error)
- func Disembed(ctx context.Context, d Disembedder, src, dst string) (err error)
- func Download(ctx context.Context, c *http.Client, src, dst string) (err error)
- func ElectronDownloadSrc(os, arch, versionElectron string) string
- func IsValidOS(os string) (ok bool)
- func PtrBool(i bool) *bool
- func PtrFloat(i float64) *float64
- func PtrInt(i int) *int
- func PtrInt64(i int64) *int64
- func PtrStr(i string) *string
- func Unzip(ctx context.Context, src, dst string) (err error)
- type Accelerator
- type Astilectron
- func (a *Astilectron) Close()
- func (a *Astilectron) Displays() []*Display
- func (a *Astilectron) Dock() *Dock
- func (a *Astilectron) HandleSignals()
- func (a *Astilectron) NewMenu(i []*MenuItemOptions) *Menu
- func (a *Astilectron) NewNotification(o *NotificationOptions) *Notification
- func (a *Astilectron) NewTray(o *TrayOptions) *Tray
- func (a *Astilectron) NewWindow(url string, o *WindowOptions) (*Window, error)
- func (a *Astilectron) NewWindowInDisplay(d *Display, url string, o *WindowOptions) (*Window, error)
- func (a *Astilectron) On(eventName string, l Listener)
- func (a *Astilectron) Paths() Paths
- func (a *Astilectron) PrimaryDisplay() *Display
- func (a *Astilectron) Quit() error
- func (a *Astilectron) SetExecuter(e Executer) *Astilectron
- func (a *Astilectron) SetProvisioner(p Provisioner) *Astilectron
- func (a *Astilectron) Start() (err error)
- func (a *Astilectron) Stop()
- func (a *Astilectron) Wait()
- type CallbackMessage
- type Disembedder
- type Display
- type DisplayOptions
- type Dock
- func (d *Dock) Bounce(bounceType string) (id int, err error)
- func (d *Dock) BounceDownloads(filePath string) (err error)
- func (d *Dock) CancelBounce(id int) (err error)
- func (d *Dock) Hide() (err error)
- func (o Dock) IsDestroyed() bool
- func (d *Dock) NewMenu(i []*MenuItemOptions) *Menu
- func (o Dock) On(eventName string, l Listener)
- func (d *Dock) SetBadge(badge string) (err error)
- func (d *Dock) SetIcon(image string) (err error)
- func (d *Dock) Show() (err error)
- type Event
- type EventAuthInfo
- type EventDisplays
- type EventMenu
- type EventMenuItem
- type EventMessage
- type EventRequest
- type EventSubMenu
- type Executer
- type Listener
- type ListenerMessage
- type Menu
- func (m Menu) Append(i *MenuItem) (err error)
- func (m Menu) ClosePopup() error
- func (m Menu) ClosePopupInWindow(w *Window) (err error)
- func (m *Menu) Create() (err error)
- func (m *Menu) Destroy() (err error)
- func (m Menu) Insert(pos int, i *MenuItem) (err error)
- func (m Menu) Item(indexes ...int) (mi *MenuItem, err error)
- func (m Menu) NewItem(o *MenuItemOptions) *MenuItem
- func (m Menu) Popup(o *MenuPopupOptions) error
- func (m Menu) PopupInWindow(w *Window, o *MenuPopupOptions) (err error)
- func (m Menu) SubMenu(indexes ...int) (s *SubMenu, err error)
- type MenuItem
- func (o MenuItem) IsDestroyed() bool
- func (o MenuItem) On(eventName string, l Listener)
- func (i *MenuItem) SetChecked(checked bool) (err error)
- func (i *MenuItem) SetEnabled(enabled bool) (err error)
- func (i *MenuItem) SetLabel(label string) (err error)
- func (i *MenuItem) SetVisible(visible bool) (err error)
- func (i *MenuItem) SubMenu() *SubMenu
- type MenuItemOptions
- type MenuPopupOptions
- type MessageBoxOptions
- type Notification
- type NotificationOptions
- type Options
- type Paths
- func (p Paths) AppExecutable() string
- func (p Paths) AppIconDarwinSrc() string
- func (p Paths) AppIconDefaultSrc() string
- func (p Paths) AstilectronApplication() string
- func (p Paths) AstilectronDirectory() string
- func (p Paths) AstilectronDownloadDst() string
- func (p Paths) AstilectronDownloadSrc() string
- func (p Paths) AstilectronUnzipSrc() string
- func (p Paths) BaseDirectory() string
- func (p Paths) DataDirectory() string
- func (p Paths) ElectronDirectory() string
- func (p Paths) ElectronDownloadDst() string
- func (p Paths) ElectronDownloadSrc() string
- func (p Paths) ElectronUnzipSrc() string
- func (p Paths) ProvisionStatus() string
- func (p Paths) VendorDirectory() string
- type Position
- type PositionOptions
- type ProvisionStatus
- type ProvisionStatusPackage
- type Provisioner
- type Rectangle
- type RectangleOptions
- type Session
- type Size
- type SizeOptions
- type SubMenu
- func (m SubMenu) Append(i *MenuItem) (err error)
- func (m SubMenu) ClosePopup() error
- func (m SubMenu) ClosePopupInWindow(w *Window) (err error)
- func (m SubMenu) Insert(pos int, i *MenuItem) (err error)
- func (m SubMenu) Item(indexes ...int) (mi *MenuItem, err error)
- func (m SubMenu) NewItem(o *MenuItemOptions) *MenuItem
- func (m SubMenu) Popup(o *MenuPopupOptions) error
- func (m SubMenu) PopupInWindow(w *Window, o *MenuPopupOptions) (err error)
- func (m SubMenu) SubMenu(indexes ...int) (s *SubMenu, err error)
- type Supported
- type Tray
- type TrayOptions
- type WebPreferences
- type Window
- func (w *Window) Blur() (err error)
- func (w *Window) Center() (err error)
- func (w *Window) Close() (err error)
- func (w *Window) CloseDevTools() (err error)
- func (w *Window) Create() (err error)
- func (w *Window) Destroy() (err error)
- func (w *Window) Focus() (err error)
- func (w *Window) Hide() (err error)
- func (o Window) IsDestroyed() bool
- func (w *Window) IsShown() bool
- func (w *Window) Log(message string) (err error)
- func (w *Window) Maximize() (err error)
- func (w *Window) Minimize() (err error)
- func (w *Window) Move(x, y int) (err error)
- func (w *Window) MoveInDisplay(d *Display, x, y int) error
- func (w *Window) NewMenu(i []*MenuItemOptions) *Menu
- func (o Window) On(eventName string, l Listener)
- func (w *Window) OnLogin(fn func(i Event) (username, password string, err error))
- func (w *Window) OnMessage(l ListenerMessage)
- func (w *Window) OpenDevTools() (err error)
- func (w *Window) Resize(width, height int) (err error)
- func (w *Window) Restore() (err error)
- func (w *Window) SendMessage(message interface{}, callbacks ...CallbackMessage) (err error)
- func (w *Window) SetBounds(r RectangleOptions) (err error)
- func (w *Window) Show() (err error)
- func (w *Window) Unmaximize() (err error)
- type WindowAppDetails
- type WindowCustomOptions
- type WindowLoadOptions
- type WindowOptions
- type WindowProxyOptions
Constants ¶
const ( DefaultAcceptTCPTimeout = 30 * time.Second DefaultVersionAstilectron = "0.33.0" DefaultVersionElectron = "4.0.1" )
Versions
const ( EventNameAppClose = "app.close" EventNameAppCmdQuit = "app.cmd.quit" // Sends an event to Electron to properly quit the app EventNameAppCmdStop = "app.cmd.stop" // Cancel the context which results in exiting abruptly Electron's app EventNameAppCrash = "app.crash" EventNameAppErrorAccept = "app.error.accept" EventNameAppEventReady = "app.event.ready" EventNameAppNoAccept = "app.no.accept" EventNameAppTooManyAccept = "app.too.many.accept" )
App event names
const ( MessageBoxTypeError = "error" MessageBoxTypeInfo = "info" MessageBoxTypeNone = "none" MessageBoxTypeQuestion = "question" MessageBoxTypeWarning = "warning" )
Message box types
const ( EventNameDisplayEventAdded = "display.event.added" EventNameDisplayEventMetricsChanged = "display.event.metrics.changed" EventNameDisplayEventRemoved = "display.event.removed" )
Display event names
const ( DockBounceTypeCritical = "critical" DockBounceTypeInformational = "informational" )
Dock bounce types
const ( EventNameMenuCmdCreate = "menu.cmd.create" EventNameMenuCmdDestroy = "menu.cmd.destroy" EventNameMenuEventCreated = "menu.event.created" EventNameMenuEventDestroyed = "menu.event.destroyed" )
Menu event names
const ( EventNameMenuItemCmdSetChecked = "menu.item.cmd.set.checked" EventNameMenuItemCmdSetEnabled = "menu.item.cmd.set.enabled" EventNameMenuItemCmdSetLabel = "menu.item.cmd.set.label" EventNameMenuItemCmdSetVisible = "menu.item.cmd.set.visible" EventNameMenuItemEventCheckedSet = "menu.item.event.checked.set" EventNameMenuItemEventClicked = "menu.item.event.clicked" EventNameMenuItemEventEnabledSet = "menu.item.event.enabled.set" EventNameMenuItemEventLabelSet = "menu.item.event.label.set" EventNameMenuItemEventVisibleSet = "menu.item.event.visible.set" )
Menu item event names
const ( EventNameNotificationEventClicked = "notification.event.clicked" EventNameNotificationEventClosed = "notification.event.closed" EventNameNotificationEventCreated = "notification.event.created" EventNameNotificationEventReplied = "notification.event.replied" EventNameNotificationEventShown = "notification.event.shown" )
Notification event names
const ( EventNameSessionCmdClearCache = "session.cmd.clear.cache" EventNameSessionEventClearedCache = "session.event.cleared.cache" EventNameSessionEventWillDownload = "session.event.will.download" )
Session event names
const ( EventNameSubMenuCmdAppend = "sub.menu.cmd.append" EventNameSubMenuCmdClosePopup = "sub.menu.cmd.close.popup" EventNameSubMenuCmdInsert = "sub.menu.cmd.insert" EventNameSubMenuCmdPopup = "sub.menu.cmd.popup" EventNameSubMenuEventAppended = "sub.menu.event.appended" EventNameSubMenuEventClosedPopup = "sub.menu.event.closed.popup" EventNameSubMenuEventInserted = "sub.menu.event.inserted" EventNameSubMenuEventPoppedUp = "sub.menu.event.popped.up" )
Sub menu event names
const ( EventNameTrayCmdCreate = "tray.cmd.create" EventNameTrayCmdDestroy = "tray.cmd.destroy" EventNameTrayCmdSetImage = "tray.cmd.set.image" EventNameTrayEventClicked = "tray.event.clicked" EventNameTrayEventCreated = "tray.event.created" EventNameTrayEventDestroyed = "tray.event.destroyed" EventNameTrayEventDoubleClicked = "tray.event.double.clicked" EventNameTrayEventImageSet = "tray.event.image.set" EventNameTrayEventRightClicked = "tray.event.right.clicked" )
Tray event names
const ( EventNameWebContentsEventLogin = "web.contents.event.login" EventNameWebContentsEventLoginCallback = "web.contents.event.login.callback" EventNameWindowCmdBlur = "window.cmd.blur" EventNameWindowCmdCenter = "window.cmd.center" EventNameWindowCmdClose = "window.cmd.close" EventNameWindowCmdCreate = "window.cmd.create" EventNameWindowCmdDestroy = "window.cmd.destroy" EventNameWindowCmdFocus = "window.cmd.focus" EventNameWindowCmdHide = "window.cmd.hide" EventNameWindowCmdLog = "window.cmd.log" EventNameWindowCmdMaximize = "window.cmd.maximize" EventNameWindowCmdMinimize = "window.cmd.minimize" EventNameWindowCmdMove = "window.cmd.move" EventNameWindowCmdResize = "window.cmd.resize" EventNameWindowCmdSetBounds = "window.cmd.set.bounds" EventNameWindowCmdRestore = "window.cmd.restore" EventNameWindowCmdShow = "window.cmd.show" EventNameWindowCmdUnmaximize = "window.cmd.unmaximize" EventNameWindowCmdWebContentsCloseDevTools = "window.cmd.web.contents.close.dev.tools" EventNameWindowCmdWebContentsOpenDevTools = "window.cmd.web.contents.open.dev.tools" EventNameWindowEventBlur = "window.event.blur" EventNameWindowEventClosed = "window.event.closed" EventNameWindowEventDidFinishLoad = "window.event.did.finish.load" EventNameWindowEventFocus = "window.event.focus" EventNameWindowEventHide = "window.event.hide" EventNameWindowEventMaximize = "window.event.maximize" EventNameWindowEventMinimize = "window.event.minimize" EventNameWindowEventMove = "window.event.move" EventNameWindowEventReadyToShow = "window.event.ready.to.show" EventNameWindowEventResize = "window.event.resize" EventNameWindowEventRestore = "window.event.restore" EventNameWindowEventShow = "window.event.show" EventNameWindowEventUnmaximize = "window.event.unmaximize" EventNameWindowEventUnresponsive = "window.event.unresponsive" EventNameWindowEventDidGetRedirectRequest = "window.event.did.get.redirect.request" )
Window event names
Variables ¶
var ( // All MenuItemRoleClose = PtrStr("close") MenuItemRoleCopy = PtrStr("copy") MenuItemRoleCut = PtrStr("cut") MenuItemRoleDelete = PtrStr("delete") MenuItemRoleEditMenu = PtrStr("editMenu") MenuItemRoleForceReload = PtrStr("forcereload") MenuItemRoleMinimize = PtrStr("minimize") MenuItemRolePaste = PtrStr("paste") MenuItemRolePasteAndMatchStyle = PtrStr("pasteandmatchstyle") MenuItemRoleQuit = PtrStr("quit") MenuItemRoleRedo = PtrStr("redo") MenuItemRoleReload = PtrStr("reload") MenuItemRoleResetZoom = PtrStr("resetzoom") MenuItemRoleSelectAll = PtrStr("selectall") MenuItemRoleToggleDevTools = PtrStr("toggledevtools") MenuItemRoleToggleFullScreen = PtrStr("togglefullscreen") MenuItemRoleUndo = PtrStr("undo") MenuItemRoleWindowMenu = PtrStr("windowMenu") MenuItemRoleZoomOut = PtrStr("zoomout") MenuItemRoleZoomIn = PtrStr("zoomin") // MacOSX MenuItemRoleAbout = PtrStr("about") MenuItemRoleHide = PtrStr("hide") MenuItemRoleHideOthers = PtrStr("hideothers") MenuItemRoleUnhide = PtrStr("unhide") MenuItemRoleStartSpeaking = PtrStr("startspeaking") MenuItemRoleStopSpeaking = PtrStr("stopspeaking") MenuItemRoleFront = PtrStr("front") MenuItemRoleZoom = PtrStr("zoom") MenuItemRoleWindow = PtrStr("window") MenuItemRoleHelp = PtrStr("help") MenuItemRoleServices = PtrStr("services") )
Menu item roles
var ( MenuItemTypeNormal = PtrStr("normal") MenuItemTypeSeparator = PtrStr("separator") MenuItemTypeCheckbox = PtrStr("checkbox") MenuItemTypeRadio = PtrStr("radio") )
Menu item types
var ( ErrCancellerCancelled = errors.New("canceller.cancelled") ErrObjectDestroyed = errors.New("object.destroyed") )
Object errors
var ( TitleBarStyleDefault = PtrStr("default") TitleBarStyleHidden = PtrStr("hidden") TitleBarStyleHiddenInset = PtrStr("hidden-inset") )
Title bar styles
var DefaultProvisioner = &defaultProvisioner{ moverAstilectron: func(ctx context.Context, p Paths) (err error) { if err = Download(ctx, defaultHTTPClient, p.AstilectronDownloadSrc(), p.AstilectronDownloadDst()); err != nil { return errors.Wrapf(err, "downloading %s into %s failed", p.AstilectronDownloadSrc(), p.AstilectronDownloadDst()) } return }, moverElectron: func(ctx context.Context, p Paths) (err error) { if err = Download(ctx, defaultHTTPClient, p.ElectronDownloadSrc(), p.ElectronDownloadDst()); err != nil { return errors.Wrapf(err, "downloading %s into %s failed", p.ElectronDownloadSrc(), p.ElectronDownloadDst()) } return }, }
DefaultProvisioner represents the default provisioner
Functions ¶
func AstilectronDownloadSrc ¶ added in v0.5.0
AstilectronDownloadSrc returns the download URL of the (currently platform-independent) astilectron zip file
func DefaultExecuter ¶ added in v0.6.0
func DefaultExecuter(a *Astilectron, cmd *exec.Cmd) (err error)
DefaultExecuter represents the default executer
func Disembed ¶ added in v0.2.0
func Disembed(ctx context.Context, d Disembedder, src, dst string) (err error)
Disembed is a cancellable disembed of an src to a dst using a custom Disembedder
func Download ¶
Download is a cancellable function that downloads a src into a dst using a specific *http.Client and cleans up on failed downloads
func ElectronDownloadSrc ¶ added in v0.5.0
ElectronDownloadSrc returns the download URL of the platform-dependant electron zipfile
Types ¶
type Accelerator ¶ added in v0.6.0
type Accelerator []string
Accelerator represents an accelerator https://github.com/electron/electron/blob/v1.8.1/docs/api/accelerator.md
func NewAccelerator ¶ added in v0.6.0
func NewAccelerator(items ...string) (a *Accelerator)
NewAccelerator creates a new accelerator
func (*Accelerator) MarshalText ¶ added in v0.6.0
func (a *Accelerator) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface
func (*Accelerator) UnmarshalText ¶ added in v0.6.0
func (a *Accelerator) UnmarshalText(b []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface
type Astilectron ¶
type Astilectron struct {
// contains filtered or unexported fields
}
Astilectron represents an object capable of interacting with Astilectron
func (*Astilectron) Displays ¶ added in v0.2.0
func (a *Astilectron) Displays() []*Display
Displays returns the displays
func (*Astilectron) HandleSignals ¶
func (a *Astilectron) HandleSignals()
HandleSignals handles signals
func (*Astilectron) NewMenu ¶ added in v0.2.0
func (a *Astilectron) NewMenu(i []*MenuItemOptions) *Menu
NewMenu creates a new app menu
func (*Astilectron) NewNotification ¶ added in v0.6.0
func (a *Astilectron) NewNotification(o *NotificationOptions) *Notification
NewNotification creates a new notification
func (*Astilectron) NewTray ¶ added in v0.5.0
func (a *Astilectron) NewTray(o *TrayOptions) *Tray
NewTray creates a new tray
func (*Astilectron) NewWindow ¶
func (a *Astilectron) NewWindow(url string, o *WindowOptions) (*Window, error)
NewWindow creates a new window
func (*Astilectron) NewWindowInDisplay ¶ added in v0.2.0
func (a *Astilectron) NewWindowInDisplay(d *Display, url string, o *WindowOptions) (*Window, error)
NewWindowInDisplay creates a new window in a specific display This overrides the center attribute
func (*Astilectron) On ¶
func (a *Astilectron) On(eventName string, l Listener)
On implements the Listenable interface
func (*Astilectron) Paths ¶ added in v0.6.0
func (a *Astilectron) Paths() Paths
Paths returns the paths
func (*Astilectron) PrimaryDisplay ¶ added in v0.2.0
func (a *Astilectron) PrimaryDisplay() *Display
PrimaryDisplay returns the primary display
func (*Astilectron) SetExecuter ¶ added in v0.6.0
func (a *Astilectron) SetExecuter(e Executer) *Astilectron
SetExecuter sets the executer
func (*Astilectron) SetProvisioner ¶
func (a *Astilectron) SetProvisioner(p Provisioner) *Astilectron
SetProvisioner sets the provisioner
type CallbackMessage ¶ added in v0.6.0
type CallbackMessage func(m *EventMessage)
CallbackMessage represents a message callback
type Disembedder ¶ added in v0.2.0
Disembedder is a functions that allows to disembed data from a path
type Display ¶ added in v0.2.0
type Display struct {
// contains filtered or unexported fields
}
Display represents a display https://github.com/electron/electron/blob/v1.8.1/docs/api/structures/display.md
func (Display) IsPrimary ¶ added in v0.2.0
IsPrimary checks whether the display is the primary display
func (Display) IsTouchAvailable ¶ added in v0.2.0
IsTouchAvailable checks whether touch is available on this display
func (Display) ScaleFactor ¶ added in v0.2.0
ScaleFactor returns the display scale factor
func (Display) WorkAreaSize ¶ added in v0.2.0
WorkAreaSize returns the display work area size
type DisplayOptions ¶ added in v0.2.0
type DisplayOptions struct { Bounds *RectangleOptions `json:"bounds,omitempty"` ID *int64 `json:"id,omitempty"` Rotation *int `json:"rotation,omitempty"` // 0, 90, 180 or 270 ScaleFactor *float64 `json:"scaleFactor,omitempty"` Size *SizeOptions `json:"size,omitempty"` TouchSupport *string `json:"touchSupport,omitempty"` // available, unavailable or unknown WorkArea *RectangleOptions `json:"workArea,omitempty"` WorkAreaSize *SizeOptions `json:"workAreaSize,omitempty"` }
DisplayOptions represents display options https://github.com/electron/electron/blob/v1.8.1/docs/api/structures/display.md
type Dock ¶ added in v0.6.0
type Dock struct {
// contains filtered or unexported fields
}
Dock represents a dock https://github.com/electron/electron/blob/v1.8.1/docs/api/app.md#appdockbouncetype-macos
func (*Dock) BounceDownloads ¶ added in v0.6.0
BounceDownloads bounces the downloads part of the dock
func (*Dock) CancelBounce ¶ added in v0.6.0
CancelBounce cancels the dock bounce
func (Dock) IsDestroyed ¶ added in v0.6.0
func (o Dock) IsDestroyed() bool
IsDestroyed checks whether the window has been destroyed
func (*Dock) NewMenu ¶ added in v0.6.0
func (d *Dock) NewMenu(i []*MenuItemOptions) *Menu
NewMenu creates a new dock menu
type Event ¶
type Event struct { // This is the base of the event Name string `json:"name"` TargetID string `json:"targetID,omitempty"` // This is a list of all possible payloads. // A choice was made not to use interfaces since it's a pain in the ass asserting each an every payload afterwards // We use pointers so that omitempty works AuthInfo *EventAuthInfo `json:"authInfo,omitempty"` Badge string `json:"badge,omitempty"` BounceType string `json:"bounceType,omitempty"` Bounds *RectangleOptions `json:"bounds,omitempty"` CallbackID string `json:"callbackId,omitempty"` Displays *EventDisplays `json:"displays,omitempty"` FilePath string `json:"filePath,omitempty"` ID *int `json:"id,omitempty"` Image string `json:"image,omitempty"` Index *int `json:"index,omitempty"` Menu *EventMenu `json:"menu,omitempty"` MenuItem *EventMenuItem `json:"menuItem,omitempty"` MenuItemOptions *MenuItemOptions `json:"menuItemOptions,omitempty"` MenuItemPosition *int `json:"menuItemPosition,omitempty"` MenuPopupOptions *MenuPopupOptions `json:"menuPopupOptions,omitempty"` Message *EventMessage `json:"message,omitempty"` NotificationOptions *NotificationOptions `json:"notificationOptions,omitempty"` Password string `json:"password,omitempty"` Reply string `json:"reply,omitempty"` Request *EventRequest `json:"request,omitempty"` SessionID string `json:"sessionId,omitempty"` Supported *Supported `json:"supported,omitempty"` TrayOptions *TrayOptions `json:"trayOptions,omitempty"` URL string `json:"url,omitempty"` URLNew string `json:"newUrl,omitempty"` URLOld string `json:"oldUrl,omitempty"` Username string `json:"username,omitempty"` WindowID string `json:"windowId,omitempty"` WindowOptions *WindowOptions `json:"windowOptions,omitempty"` }
Event represents an event
type EventAuthInfo ¶ added in v0.6.0
type EventAuthInfo struct { Host string `json:"host,omitempty"` IsProxy *bool `json:"isProxy,omitempty"` Port *int `json:"port,omitempty"` Realm string `json:"realm,omitempty"` Scheme string `json:"scheme,omitempty"` }
EventAuthInfo represents an event auth info
type EventDisplays ¶ added in v0.2.0
type EventDisplays struct { All []*DisplayOptions `json:"all,omitempty"` Primary *DisplayOptions `json:"primary,omitempty"` }
EventDisplays represents events displays
type EventMenu ¶ added in v0.2.0
type EventMenu struct {
*EventSubMenu
}
EventMenu represents an event menu
type EventMenuItem ¶ added in v0.2.0
type EventMenuItem struct { ID string `json:"id"` Options *MenuItemOptions `json:"options,omitempty"` RootID string `json:"rootId"` SubMenu *EventSubMenu `json:"submenu,omitempty"` }
EventMenuItem represents an event menu item
type EventMessage ¶
type EventMessage struct {
// contains filtered or unexported fields
}
EventMessage represents an event message
func (*EventMessage) MarshalJSON ¶
func (p *EventMessage) MarshalJSON() ([]byte, error)
MarshalJSON implements the JSONMarshaler interface
func (*EventMessage) Unmarshal ¶
func (p *EventMessage) Unmarshal(i interface{}) error
Unmarshal unmarshals the payload into the given interface
func (*EventMessage) UnmarshalJSON ¶
func (p *EventMessage) UnmarshalJSON(i []byte) error
UnmarshalJSON implements the JSONUnmarshaler interface
type EventRequest ¶ added in v0.6.0
type EventRequest struct { Method string `json:"method,omitempty"` Referrer string `json:"referrer,omitempty"` URL string `json:"url,omitempty"` }
EventRequest represents an event request
type EventSubMenu ¶ added in v0.2.0
type EventSubMenu struct { ID string `json:"id"` Items []*EventMenuItem `json:"items,omitempty"` RootID string `json:"rootId"` }
EventSubMenu represents a sub menu event
type Executer ¶ added in v0.6.0
type Executer func(a *Astilectron, cmd *exec.Cmd) (err error)
Executer represents an object capable of executing Astilectron run command
type ListenerMessage ¶ added in v0.6.0
type ListenerMessage func(m *EventMessage) (v interface{})
ListenerMessage represents a message listener executed when receiving a message from the JS
type Menu ¶ added in v0.2.0
type Menu struct {
// contains filtered or unexported fields
}
Menu represents a menu https://github.com/electron/electron/blob/v1.8.1/docs/api/menu.md
func (Menu) ClosePopup ¶ added in v0.2.0
func (m Menu) ClosePopup() error
ClosePopup close the context menu in the focused window
func (Menu) ClosePopupInWindow ¶ added in v0.2.0
ClosePopupInWindow close the context menu in the specified window
func (Menu) NewItem ¶ added in v0.2.0
func (m Menu) NewItem(o *MenuItemOptions) *MenuItem
NewItem returns a new menu item
func (Menu) Popup ¶ added in v0.2.0
func (m Menu) Popup(o *MenuPopupOptions) error
Popup pops up the menu as a context menu in the focused window
func (Menu) PopupInWindow ¶ added in v0.2.0
func (m Menu) PopupInWindow(w *Window, o *MenuPopupOptions) (err error)
PopupInWindow pops up the menu as a context menu in the specified window
type MenuItem ¶ added in v0.2.0
type MenuItem struct {
// contains filtered or unexported fields
}
MenuItem represents a menu item
func (MenuItem) IsDestroyed ¶ added in v0.2.0
func (o MenuItem) IsDestroyed() bool
IsDestroyed checks whether the window has been destroyed
func (*MenuItem) SetChecked ¶ added in v0.2.0
SetChecked sets the checked attribute
func (*MenuItem) SetEnabled ¶ added in v0.2.0
SetEnabled sets the enabled attribute
func (*MenuItem) SetVisible ¶ added in v0.2.0
SetVisible sets the visible attribute
type MenuItemOptions ¶ added in v0.2.0
type MenuItemOptions struct { Accelerator *Accelerator `json:"accelerator,omitempty"` Checked *bool `json:"checked,omitempty"` Enabled *bool `json:"enabled,omitempty"` Icon *string `json:"icon,omitempty"` Label *string `json:"label,omitempty"` OnClick Listener `json:"-"` Position *string `json:"position,omitempty"` Role *string `json:"role,omitempty"` SubLabel *string `json:"sublabel,omitempty"` SubMenu []*MenuItemOptions `json:"-"` Type *string `json:"type,omitempty"` Visible *bool `json:"visible,omitempty"` }
MenuItemOptions represents menu item options We must use pointers since GO doesn't handle optional fields whereas NodeJS does. Use PtrBool, PtrInt or PtrStr to fill the struct https://github.com/electron/electron/blob/v1.8.1/docs/api/menu-item.md
type MenuPopupOptions ¶ added in v0.2.0
type MenuPopupOptions struct { PositionOptions PositioningItem *int `json:"positioningItem,omitempty"` }
MenuPopupOptions represents menu pop options
type MessageBoxOptions ¶ added in v0.6.0
type MessageBoxOptions struct { Buttons []string `json:"buttons,omitempty"` CancelID *int `json:"cancelId,omitempty"` CheckboxChecked *bool `json:"checkboxChecked,omitempty"` CheckboxLabel string `json:"checkboxLabel,omitempty"` ConfirmID *int `json:"confirmId,omitempty"` DefaultID *int `json:"defaultId,omitempty"` Detail string `json:"detail,omitempty"` Icon string `json:"icon,omitempty"` Message string `json:"message,omitempty"` NoLink *bool `json:"noLink,omitempty"` Title string `json:"title,omitempty"` Type string `json:"type,omitempty"` }
MessageBoxOptions represents message box options We must use pointers since GO doesn't handle optional fields whereas NodeJS does. Use PtrBool, PtrInt or PtrStr to fill the struct https://github.com/electron/electron/blob/v1.8.1/docs/api/dialog.md#dialogshowmessageboxbrowserwindow-options-callback
type Notification ¶ added in v0.6.0
type Notification struct {
// contains filtered or unexported fields
}
Notification represents a notification https://github.com/electron/electron/blob/v1.8.1/docs/api/notification.md
func (*Notification) Create ¶ added in v0.6.0
func (n *Notification) Create() (err error)
Create creates the notification
func (Notification) IsDestroyed ¶ added in v0.6.0
func (o Notification) IsDestroyed() bool
IsDestroyed checks whether the window has been destroyed
func (*Notification) Show ¶ added in v0.6.0
func (n *Notification) Show() (err error)
Show shows the notification
type NotificationOptions ¶ added in v0.6.0
type NotificationOptions struct { Body string `json:"body,omitempty"` HasReply *bool `json:"hasReply,omitempty"` Icon string `json:"icon,omitempty"` ReplyPlaceholder string `json:"replyPlaceholder,omitempty"` Silent *bool `json:"silent,omitempty"` Sound string `json:"sound,omitempty"` Subtitle string `json:"subtitle,omitempty"` Title string `json:"title,omitempty"` }
NotificationOptions represents notification options
type Options ¶
type Options struct { AcceptTCPTimeout time.Duration AppName string AppIconDarwinPath string // Darwin systems requires a specific .icns file AppIconDefaultPath string BaseDirectoryPath string DataDirectoryPath string ElectronSwitches []string SingleInstance bool SkipSetup bool // If true, the user must handle provisioning and executing astilectron. TCPPort *int // The port to listen on. VersionAstilectron string VersionElectron string }
Options represents Astilectron options
type Paths ¶
type Paths struct {
// contains filtered or unexported fields
}
Paths represents the set of paths needed by Astilectron
func (Paths) AppExecutable ¶ added in v0.2.0
AppExecutable returns the app executable path
func (Paths) AppIconDarwinSrc ¶ added in v0.2.0
AppIconDarwinSrc returns the darwin app icon path
func (Paths) AppIconDefaultSrc ¶ added in v0.6.0
AppIconDefaultSrc returns the default app icon path
func (Paths) AstilectronApplication ¶
AstilectronApplication returns the astilectron application path
func (Paths) AstilectronDirectory ¶
AstilectronDirectory returns the astilectron directory path
func (Paths) AstilectronDownloadDst ¶
AstilectronDownloadDst returns the astilectron download destination path
func (Paths) AstilectronDownloadSrc ¶
AstilectronDownloadSrc returns the astilectron download source path
func (Paths) AstilectronUnzipSrc ¶
AstilectronUnzipSrc returns the astilectron unzip source path
func (Paths) BaseDirectory ¶
BaseDirectory returns the base directory path
func (Paths) DataDirectory ¶ added in v0.6.0
DataDirectory returns the data directory path
func (Paths) ElectronDirectory ¶
ElectronDirectory returns the electron directory path
func (Paths) ElectronDownloadDst ¶
ElectronDownloadDst returns the electron download destination path
func (Paths) ElectronDownloadSrc ¶
ElectronDownloadSrc returns the electron download source path
func (Paths) ElectronUnzipSrc ¶
ElectronUnzipSrc returns the electron unzip source path
func (Paths) ProvisionStatus ¶ added in v0.2.0
ProvisionStatus returns the provision status path
func (Paths) VendorDirectory ¶
VendorDirectory returns the vendor directory path
type PositionOptions ¶ added in v0.2.0
PositionOptions represents position options
type ProvisionStatus ¶ added in v0.2.0
type ProvisionStatus struct { Astilectron *ProvisionStatusPackage `json:"astilectron,omitempty"` Electron map[string]*ProvisionStatusPackage `json:"electron,omitempty"` }
ProvisionStatus represents the provision status
type ProvisionStatusPackage ¶ added in v0.2.0
type ProvisionStatusPackage struct {
Version string `json:"version"`
}
ProvisionStatusPackage represents the provision status of a package
type Provisioner ¶
type Provisioner interface {
Provision(ctx context.Context, appName, os, arch, versionAstilectron, versionElectron string, p Paths) error
}
Provisioner represents an object capable of provisioning Astilectron
func NewDisembedderProvisioner ¶ added in v0.2.0
func NewDisembedderProvisioner(d Disembedder, pathAstilectron, pathElectron string) Provisioner
NewDisembedderProvisioner creates a provisioner that can provision based on embedded data
type RectangleOptions ¶ added in v0.2.0
type RectangleOptions struct { PositionOptions SizeOptions }
RectangleOptions represents rectangle options
type Session ¶ added in v0.6.0
type Session struct {
// contains filtered or unexported fields
}
Session represents a session TODO Add missing session methods TODO Add missing session events https://github.com/electron/electron/blob/v1.8.1/docs/api/session.md
func (*Session) ClearCache ¶ added in v0.6.0
ClearCache clears the Session's HTTP cache
func (Session) IsDestroyed ¶ added in v0.6.0
func (o Session) IsDestroyed() bool
IsDestroyed checks whether the window has been destroyed
type SizeOptions ¶ added in v0.2.0
type SizeOptions struct { Height *int `json:"height,omitempty"` Width *int `json:"width,omitempty"` }
SizeOptions represents size options
type SubMenu ¶ added in v0.2.0
type SubMenu struct {
// contains filtered or unexported fields
}
SubMenu represents an exported sub menu
func (SubMenu) ClosePopup ¶ added in v0.2.0
func (m SubMenu) ClosePopup() error
ClosePopup close the context menu in the focused window
func (SubMenu) ClosePopupInWindow ¶ added in v0.2.0
ClosePopupInWindow close the context menu in the specified window
func (SubMenu) NewItem ¶ added in v0.2.0
func (m SubMenu) NewItem(o *MenuItemOptions) *MenuItem
NewItem returns a new menu item
func (SubMenu) Popup ¶ added in v0.2.0
func (m SubMenu) Popup(o *MenuPopupOptions) error
Popup pops up the menu as a context menu in the focused window
func (SubMenu) PopupInWindow ¶ added in v0.2.0
func (m SubMenu) PopupInWindow(w *Window, o *MenuPopupOptions) (err error)
PopupInWindow pops up the menu as a context menu in the specified window
type Supported ¶ added in v0.6.0
type Supported struct {
Notification *bool `json:"notification"`
}
Supported represents Astilectron supported features
type Tray ¶ added in v0.5.0
type Tray struct {
// contains filtered or unexported fields
}
Tray represents a tray
func (Tray) IsDestroyed ¶ added in v0.5.0
func (o Tray) IsDestroyed() bool
IsDestroyed checks whether the window has been destroyed
func (*Tray) NewMenu ¶ added in v0.5.0
func (t *Tray) NewMenu(i []*MenuItemOptions) *Menu
NewMenu creates a new tray menu
type TrayOptions ¶ added in v0.5.0
type TrayOptions struct { Image *string `json:"image,omitempty"` Tooltip *string `json:"tooltip,omitempty"` }
TrayOptions represents tray options We must use pointers since GO doesn't handle optional fields whereas NodeJS does. Use PtrBool, PtrInt or PtrStr to fill the struct https://github.com/electron/electron/blob/v1.8.1/docs/api/tray.md
type WebPreferences ¶ added in v0.5.0
type WebPreferences struct { AllowRunningInsecureContent *bool `json:"allowRunningInsecureContent,omitempty"` BackgroundThrottling *bool `json:"backgroundThrottling,omitempty"` BlinkFeatures *string `json:"blinkFeatures,omitempty"` ContextIsolation *bool `json:"contextIsolation,omitempty"` DefaultEncoding *string `json:"defaultEncoding,omitempty"` DefaultFontFamily map[string]interface{} `json:"defaultFontFamily,omitempty"` DefaultFontSize *int `json:"defaultFontSize,omitempty"` DefaultMonospaceFontSize *int `json:"defaultMonospaceFontSize,omitempty"` DevTools *bool `json:"devTools,omitempty"` DisableBlinkFeatures *string `json:"disableBlinkFeatures,omitempty"` ExperimentalCanvasFeatures *bool `json:"experimentalCanvasFeatures,omitempty"` ExperimentalFeatures *bool `json:"experimentalFeatures,omitempty"` Images *bool `json:"images,omitempty"` Javascript *bool `json:"javascript,omitempty"` MinimumFontSize *int `json:"minimumFontSize,omitempty"` NodeIntegration *bool `json:"nodeIntegration,omitempty"` NodeIntegrationInWorker *bool `json:"nodeIntegrationInWorker,omitempty"` Offscreen *bool `json:"offscreen,omitempty"` Partition *string `json:"partition,omitempty"` Plugins *bool `json:"plugins,omitempty"` Preload *string `json:"preload,omitempty"` Sandbox *bool `json:"sandbox,omitempty"` ScrollBounce *bool `json:"scrollBounce,omitempty"` Session map[string]interface{} `json:"session,omitempty"` TextAreasAreResizable *bool `json:"textAreasAreResizable,omitempty"` Webaudio *bool `json:"webaudio,omitempty"` Webgl *bool `json:"webgl,omitempty"` WebSecurity *bool `json:"webSecurity,omitempty"` ZoomFactor *float64 `json:"zoomFactor,omitempty"` }
WebPreferences represents web preferences in window options. We must use pointers since GO doesn't handle optional fields whereas NodeJS does. Use PtrBool, PtrInt or PtrStr to fill the struct
type Window ¶
type Window struct { Session *Session // contains filtered or unexported fields }
Window represents a window TODO Add missing window options TODO Add missing window methods TODO Add missing window events
func (*Window) CloseDevTools ¶
CloseDevTools closes the dev tools
func (*Window) Create ¶
Create creates the window We wait for EventNameWindowEventDidFinishLoad since we need the web content to be fully loaded before being able to send messages to it
func (Window) IsDestroyed ¶ added in v0.2.0
func (o Window) IsDestroyed() bool
IsDestroyed checks whether the window has been destroyed
func (*Window) MoveInDisplay ¶ added in v0.2.0
MoveInDisplay moves the window in the proper display
func (*Window) NewMenu ¶ added in v0.2.0
func (w *Window) NewMenu(i []*MenuItemOptions) *Menu
NewMenu creates a new window menu
func (*Window) OnMessage ¶ added in v0.6.0
func (w *Window) OnMessage(l ListenerMessage)
OnMessage adds a specific listener executed when receiving a message from the JS This method can be called only once
func (*Window) OpenDevTools ¶
OpenDevTools opens the dev tools
func (*Window) SendMessage ¶ added in v0.6.0
func (w *Window) SendMessage(message interface{}, callbacks ...CallbackMessage) (err error)
SendMessage sends a message to the JS window and execute optional callbacks upon receiving a response from the JS Use astilectron.onMessage method to capture those messages in JS
func (*Window) SetBounds ¶ added in v0.9.0
func (w *Window) SetBounds(r RectangleOptions) (err error)
SetBounds set bounds of the window
func (*Window) Unmaximize ¶
Unmaximize unmaximize the window
type WindowAppDetails ¶ added in v0.9.0
type WindowAppDetails struct { AppID *string `json:"appId,omitempty"` AppIconPath *string `json:"appIconPath,omitempty"` RelaunchCommand *string `json:"relaunchCommand,omitempty"` AppIconIndex *int `json:"appIconIndex,omitempty"` RelaunchDisplayName *string `json:"relaunchDisplayName,omitempty"` }
WindowAppDetails represents window app details https://github.com/electron/electron/blob/v4.0.1/docs/api/browser-window.md#winsetappdetailsoptions-windows
type WindowCustomOptions ¶ added in v0.6.0
type WindowCustomOptions struct { HideOnClose *bool `json:"hideOnClose,omitempty"` MessageBoxOnClose *MessageBoxOptions `json:"messageBoxOnClose,omitempty"` MinimizeOnClose *bool `json:"minimizeOnClose,omitempty"` Script string `json:"script,omitempty"` }
WindowCustomOptions represents window custom options
type WindowLoadOptions ¶ added in v0.6.0
type WindowLoadOptions struct { ExtraHeaders string `json:"extraHeaders,omitempty"` HTTPReferer string `json:"httpReferrer,omitempty"` UserAgent string `json:"userAgent,omitempty"` }
WindowLoadOptions represents window load options https://github.com/electron/electron/blob/v1.8.1/docs/api/browser-window.md#winloadurlurl-options
type WindowOptions ¶
type WindowOptions struct { AcceptFirstMouse *bool `json:"acceptFirstMouse,omitempty"` AlwaysOnTop *bool `json:"alwaysOnTop,omitempty"` AutoHideMenuBar *bool `json:"autoHideMenuBar,omitempty"` BackgroundColor *string `json:"backgroundColor,omitempty"` Center *bool `json:"center,omitempty"` Closable *bool `json:"closable,omitempty"` DisableAutoHideCursor *bool `json:"disableAutoHideCursor,omitempty"` EnableLargerThanScreen *bool `json:"enableLargerThanScreen,omitempty"` Focusable *bool `json:"focusable,omitempty"` Frame *bool `json:"frame,omitempty"` Fullscreen *bool `json:"fullscreen,omitempty"` Fullscreenable *bool `json:"fullscreenable,omitempty"` HasShadow *bool `json:"hasShadow,omitempty"` Height *int `json:"height,omitempty"` Icon *string `json:"icon,omitempty"` Kiosk *bool `json:"kiosk,omitempty"` MaxHeight *int `json:"maxHeight,omitempty"` Maximizable *bool `json:"maximizable,omitempty"` MaxWidth *int `json:"maxWidth,omitempty"` MinHeight *int `json:"minHeight,omitempty"` Minimizable *bool `json:"minimizable,omitempty"` MinWidth *int `json:"minWidth,omitempty"` Modal *bool `json:"modal,omitempty"` Movable *bool `json:"movable,omitempty"` Resizable *bool `json:"resizable,omitempty"` Show *bool `json:"show,omitempty"` SkipTaskbar *bool `json:"skipTaskbar,omitempty"` Title *string `json:"title,omitempty"` TitleBarStyle *string `json:"titleBarStyle,omitempty"` Transparent *bool `json:"transparent,omitempty"` UseContentSize *bool `json:"useContentSize,omitempty"` WebPreferences *WebPreferences `json:"webPreferences,omitempty"` Width *int `json:"width,omitempty"` X *int `json:"x,omitempty"` Y *int `json:"y,omitempty"` // Additional options AppDetails *WindowAppDetails `json:"appDetails,omitempty"` Custom *WindowCustomOptions `json:"custom,omitempty"` Load *WindowLoadOptions `json:"load,omitempty"` Proxy *WindowProxyOptions `json:"proxy,omitempty"` }
WindowOptions represents window options We must use pointers since GO doesn't handle optional fields whereas NodeJS does. Use PtrBool, PtrInt or PtrStr to fill the struct https://github.com/electron/electron/blob/v1.8.1/docs/api/browser-window.md
type WindowProxyOptions ¶ added in v0.6.0
type WindowProxyOptions struct { BypassRules string `json:"proxyBypassRules,omitempty"` PACScript string `json:"pacScript,omitempty"` Rules string `json:"proxyRules,omitempty"` }
WindowProxyOptions represents window proxy options https://github.com/electron/electron/blob/v1.8.1/docs/api/session.md#sessetproxyconfig-callback