Documentation ¶
Index ¶
- Constants
- Variables
- func AstilectronDownloadSrc(versionAstilectron string) string
- func DefaultExecuter(l astikit.SeverityLogger, a *Astilectron, cmd *exec.Cmd) (err error)
- func Disembed(ctx context.Context, l astikit.SeverityLogger, d Disembedder, src, dst string) (err error)
- func Download(ctx context.Context, l astikit.SeverityLogger, d *astikit.HTTPDownloader, ...) (err error)
- func ElectronDownloadSrc(os, arch, versionElectron string) string
- func IsValidOS(os string) (ok bool)
- func Unzip(ctx context.Context, l astikit.SeverityLogger, 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(hs ...astikit.SignalHandler)
- 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
- func (d Display) Bounds() Rectangle
- func (d Display) ID() int64
- func (d Display) IsPrimary() bool
- func (d Display) IsTouchAvailable() bool
- func (d Display) Rotation() int
- func (d Display) ScaleFactor() float64
- func (d Display) Size() Size
- func (d Display) WorkArea() Rectangle
- func (d Display) WorkAreaSize() Size
- 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 (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) 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) ExecuteJavaScript(code string) (err error)
- func (w *Window) Focus() (err error)
- func (w *Window) Hide() (err error)
- 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.39.0" DefaultVersionElectron = "7.1.10" )
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" EventNameSessionCmdFlushStorage = "session.cmd.flush.storage" EventNameSessionEventFlushedStorage = "session.event.flushed.storage" )
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" EventNameWindowCmdWebContentsExecuteJavaScript = "window.cmd.web.contents.execute.javascript" 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" EventNameWindowEventWebContentsExecutedJavaScript = "window.event.web.contents.executed.javascript" )
Window event names
Variables ¶
var ( // All MenuItemRoleClose = astikit.StrPtr("close") MenuItemRoleCopy = astikit.StrPtr("copy") MenuItemRoleCut = astikit.StrPtr("cut") MenuItemRoleDelete = astikit.StrPtr("delete") MenuItemRoleEditMenu = astikit.StrPtr("editMenu") MenuItemRoleForceReload = astikit.StrPtr("forcereload") MenuItemRoleMinimize = astikit.StrPtr("minimize") MenuItemRolePaste = astikit.StrPtr("paste") MenuItemRolePasteAndMatchStyle = astikit.StrPtr("pasteandmatchstyle") MenuItemRoleQuit = astikit.StrPtr("quit") MenuItemRoleRedo = astikit.StrPtr("redo") MenuItemRoleReload = astikit.StrPtr("reload") MenuItemRoleResetZoom = astikit.StrPtr("resetzoom") MenuItemRoleSelectAll = astikit.StrPtr("selectall") MenuItemRoleToggleDevTools = astikit.StrPtr("toggledevtools") MenuItemRoleToggleFullScreen = astikit.StrPtr("togglefullscreen") MenuItemRoleUndo = astikit.StrPtr("undo") MenuItemRoleWindowMenu = astikit.StrPtr("windowMenu") MenuItemRoleZoomOut = astikit.StrPtr("zoomout") MenuItemRoleZoomIn = astikit.StrPtr("zoomin") // MacOSX MenuItemRoleAbout = astikit.StrPtr("about") MenuItemRoleHide = astikit.StrPtr("hide") MenuItemRoleHideOthers = astikit.StrPtr("hideothers") MenuItemRoleUnhide = astikit.StrPtr("unhide") MenuItemRoleStartSpeaking = astikit.StrPtr("startspeaking") MenuItemRoleStopSpeaking = astikit.StrPtr("stopspeaking") MenuItemRoleFront = astikit.StrPtr("front") MenuItemRoleZoom = astikit.StrPtr("zoom") MenuItemRoleWindow = astikit.StrPtr("window") MenuItemRoleHelp = astikit.StrPtr("help") MenuItemRoleServices = astikit.StrPtr("services") )
Menu item roles
var ( MenuItemTypeNormal = astikit.StrPtr("normal") MenuItemTypeSeparator = astikit.StrPtr("separator") MenuItemTypeCheckbox = astikit.StrPtr("checkbox") MenuItemTypeRadio = astikit.StrPtr("radio") )
Menu item types
var ( TitleBarStyleDefault = astikit.StrPtr("default") TitleBarStyleHidden = astikit.StrPtr("hidden") TitleBarStyleHiddenInset = astikit.StrPtr("hidden-inset") )
Title bar styles
Functions ¶
func AstilectronDownloadSrc ¶
AstilectronDownloadSrc returns the download URL of the (currently platform-independent) astilectron zip file
func DefaultExecuter ¶
func DefaultExecuter(l astikit.SeverityLogger, a *Astilectron, cmd *exec.Cmd) (err error)
DefaultExecuter represents the default executer
func Disembed ¶
func Disembed(ctx context.Context, l astikit.SeverityLogger, d Disembedder, src, dst string) (err error)
Disembed is a cancellable disembed of an src to a dst using a custom Disembedder
func Download ¶
func Download(ctx context.Context, l astikit.SeverityLogger, d *astikit.HTTPDownloader, src, dst string) (err error)
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 ¶
ElectronDownloadSrc returns the download URL of the platform-dependant electron zipfile
Types ¶
type Accelerator ¶
type Accelerator []string
Accelerator represents an accelerator https://github.com/electron/electron/blob/v1.8.1/docs/api/accelerator.md
func NewAccelerator ¶
func NewAccelerator(items ...string) (a *Accelerator)
NewAccelerator creates a new accelerator
func (*Accelerator) MarshalText ¶
func (a *Accelerator) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface
func (*Accelerator) UnmarshalText ¶
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 New ¶
func New(l astikit.StdLogger, o Options) (a *Astilectron, err error)
New creates a new Astilectron instance
func (*Astilectron) Displays ¶
func (a *Astilectron) Displays() []*Display
Displays returns the displays
func (*Astilectron) HandleSignals ¶
func (a *Astilectron) HandleSignals(hs ...astikit.SignalHandler)
HandleSignals handles signals
func (*Astilectron) NewMenu ¶
func (a *Astilectron) NewMenu(i []*MenuItemOptions) *Menu
NewMenu creates a new app menu
func (*Astilectron) NewNotification ¶
func (a *Astilectron) NewNotification(o *NotificationOptions) *Notification
NewNotification creates a new notification
func (*Astilectron) NewTray ¶
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 ¶
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) PrimaryDisplay ¶
func (a *Astilectron) PrimaryDisplay() *Display
PrimaryDisplay returns the primary display
func (*Astilectron) SetExecuter ¶
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 ¶
type CallbackMessage func(m *EventMessage)
CallbackMessage represents a message callback
type Disembedder ¶
Disembedder is a functions that allows to disembed data from a path
type Display ¶
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) IsTouchAvailable ¶
IsTouchAvailable checks whether touch is available on this display
func (Display) ScaleFactor ¶
ScaleFactor returns the display scale factor
func (Display) WorkAreaSize ¶
WorkAreaSize returns the display work area size
type DisplayOptions ¶
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 ¶
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 ¶
BounceDownloads bounces the downloads part of the dock
func (*Dock) CancelBounce ¶
CancelBounce cancels the dock bounce
func (*Dock) NewMenu ¶
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"` Code string `json:"code,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 ¶
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 ¶
type EventDisplays struct { All []*DisplayOptions `json:"all,omitempty"` Primary *DisplayOptions `json:"primary,omitempty"` }
EventDisplays represents events displays
type EventMenuItem ¶
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 ¶
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 ¶
type EventSubMenu struct { ID string `json:"id"` Items []*EventMenuItem `json:"items,omitempty"` RootID string `json:"rootId"` }
EventSubMenu represents a sub menu event
type Executer ¶
type Executer func(l astikit.SeverityLogger, a *Astilectron, cmd *exec.Cmd) (err error)
Executer represents an object capable of executing Astilectron run command
type ListenerMessage ¶
type ListenerMessage func(m *EventMessage) (v interface{})
ListenerMessage represents a message listener executed when receiving a message from the JS
type Menu ¶
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 ¶
func (m Menu) ClosePopup() error
ClosePopup close the context menu in the focused window
func (Menu) ClosePopupInWindow ¶
ClosePopupInWindow close the context menu in the specified window
func (Menu) NewItem ¶
func (m Menu) NewItem(o *MenuItemOptions) *MenuItem
NewItem returns a new menu item
func (Menu) Popup ¶
func (m Menu) Popup(o *MenuPopupOptions) error
Popup pops up the menu as a context menu in the focused window
func (Menu) PopupInWindow ¶
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 ¶
type MenuItem struct {
// contains filtered or unexported fields
}
MenuItem represents a menu item
func (*MenuItem) SetChecked ¶
SetChecked sets the checked attribute
func (*MenuItem) SetEnabled ¶
SetEnabled sets the enabled attribute
func (*MenuItem) SetVisible ¶
SetVisible sets the visible attribute
type MenuItemOptions ¶
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 astikit.BoolPtr, astikit.IntPtr or astikit.StrPtr to fill the struct https://github.com/electron/electron/blob/v1.8.1/docs/api/menu-item.md
type MenuPopupOptions ¶
type MenuPopupOptions struct { PositionOptions PositioningItem *int `json:"positioningItem,omitempty"` }
MenuPopupOptions represents menu pop options
type MessageBoxOptions ¶
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 astikit.BoolPtr, astikit.IntPtr or astikit.StrPtr to fill the struct https://github.com/electron/electron/blob/v1.8.1/docs/api/dialog.md#dialogshowmessageboxbrowserwindow-options-callback
type Notification ¶
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 ¶
func (n *Notification) Create() (err error)
Create creates the notification
type NotificationOptions ¶
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 { PubEvent func(e Event) error 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 ¶
AppExecutable returns the app executable path
func (Paths) AppIconDarwinSrc ¶
AppIconDarwinSrc returns the darwin app icon path
func (Paths) AppIconDefaultSrc ¶
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 ¶
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 ¶
ProvisionStatus returns the provision status path
func (Paths) VendorDirectory ¶
VendorDirectory returns the vendor directory path
type PositionOptions ¶
PositionOptions represents position options
type ProvisionStatus ¶
type ProvisionStatus struct { Astilectron *ProvisionStatusPackage `json:"astilectron,omitempty"` Electron map[string]*ProvisionStatusPackage `json:"electron,omitempty"` }
ProvisionStatus represents the provision status
type ProvisionStatusPackage ¶
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 ¶
func NewDisembedderProvisioner(d Disembedder, pathAstilectron, pathElectron string, l astikit.StdLogger) Provisioner
NewDisembedderProvisioner creates a provisioner that can provision based on embedded data
type RectangleOptions ¶
type RectangleOptions struct { PositionOptions SizeOptions }
RectangleOptions represents rectangle options
type Session ¶
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 ¶
ClearCache clears the Session's HTTP cache
func (*Session) FlushStorage ¶
FlushStorage writes any unwritten DOMStorage data to disk
type SizeOptions ¶
type SizeOptions struct { Height *int `json:"height,omitempty"` Width *int `json:"width,omitempty"` }
SizeOptions represents size options
type SubMenu ¶
type SubMenu struct {
// contains filtered or unexported fields
}
SubMenu represents an exported sub menu
func (SubMenu) ClosePopup ¶
func (m SubMenu) ClosePopup() error
ClosePopup close the context menu in the focused window
func (SubMenu) ClosePopupInWindow ¶
ClosePopupInWindow close the context menu in the specified window
func (SubMenu) NewItem ¶
func (m SubMenu) NewItem(o *MenuItemOptions) *MenuItem
NewItem returns a new menu item
func (SubMenu) Popup ¶
func (m SubMenu) Popup(o *MenuPopupOptions) error
Popup pops up the menu as a context menu in the focused window
func (SubMenu) PopupInWindow ¶
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 ¶
type Supported struct {
Notification *bool `json:"notification"`
}
Supported represents Astilectron supported features
type Tray ¶
type Tray struct {
// contains filtered or unexported fields
}
Tray represents a tray
func (*Tray) NewMenu ¶
func (t *Tray) NewMenu(i []*MenuItemOptions) *Menu
NewMenu creates a new tray menu
type TrayOptions ¶
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 astikit.BoolPtr, astikit.IntPtr or astikit.StrPtr to fill the struct https://github.com/electron/electron/blob/v1.8.1/docs/api/tray.md
type WebPreferences ¶
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"` // This attribute needs to be true at all time // 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"` WebviewTag *bool `json:"webviewTag,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 astikit.BoolPtr, astikit.IntPtr or astikit.StrPtr 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) ExecuteJavaScript ¶
ExecuteJavaScript executes some js
func (*Window) MoveInDisplay ¶
MoveInDisplay moves the window in the proper display
func (*Window) NewMenu ¶
func (w *Window) NewMenu(i []*MenuItemOptions) *Menu
NewMenu creates a new window menu
func (*Window) OnMessage ¶
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 ¶
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 ¶
func (w *Window) SetBounds(r RectangleOptions) (err error)
SetBounds set bounds of the window
func (*Window) Unmaximize ¶
Unmaximize unmaximize the window
type WindowAppDetails ¶
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 ¶
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 ¶
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 astikit.BoolPtr, astikit.IntPtr or astikit.StrPtr to fill the struct https://github.com/electron/electron/blob/v1.8.1/docs/api/browser-window.md
type WindowProxyOptions ¶
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