Documentation ¶
Index ¶
- Constants
- Variables
- 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 PtrBool(i bool) *bool
- func PtrFloat(i float64) *float64
- func PtrInt(i int) *int
- func PtrStr(i string) *string
- func Unzip(ctx context.Context, src, dst string) error
- type Astilectron
- func (a *Astilectron) Close()
- func (a *Astilectron) Displays() []*Display
- func (a *Astilectron) HandleSignals()
- func (a *Astilectron) NewMenu(i []*MenuItemOptions) *Menu
- 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) PrimaryDisplay() *Display
- func (a *Astilectron) SetProvisioner(p Provisioner) *Astilectron
- func (a *Astilectron) Start() (err error)
- func (a *Astilectron) Stop()
- func (a *Astilectron) Wait()
- type Disembedder
- type Dispatcher
- type Display
- type DisplayOptions
- type Event
- type EventDisplays
- type EventMenu
- type EventMenuItem
- type EventMessage
- type EventSubMenu
- type Listener
- 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 Options
- type Paths
- func (p *Paths) AppExecutable() string
- func (p *Paths) AppIconDarwinSrc() 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) 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 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 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) 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) OpenDevTools() (err error)
- func (w *Window) Resize(width, height int) (err error)
- func (w *Window) Restore() (err error)
- func (w *Window) Send(message interface{}) (err error)
- func (w *Window) Show() (err error)
- func (w *Window) Unmaximize() (err error)
- type WindowOptions
Constants ¶
const ( EventNameAppClose = "app.close" EventNameAppCmdStop = "app.cmd.stop" EventNameAppCrash = "app.crash" EventNameAppErrorAccept = "app.error.accept" EventNameAppEventReady = "app.event.ready" EventNameAppNoAccept = "app.no.accept" EventNameAppTooManyAccept = "app.too.many.accept" )
App event names
const ( EventNameDisplayEventAdded = "display.event.added" EventNameDisplayEventMetricsChanged = "display.event.metrics.changed" EventNameDisplayEventRemoved = "display.event.removed" )
Display event names
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 ( EventNameProvisionAstilectronAlreadyProvisioned = "provision.astilectron.already.provisioned" EventNameProvisionAstilectronFinished = "provision.astilectron.finished" EventNameProvisionAstilectronMoved = "provision.astilectron.moved" EventNameProvisionAstilectronUnzipped = "provision.astilectron.unzipped" EventNameProvisionElectronAlreadyProvisioned = "provision.electron.already.provisioned" EventNameProvisionElectronFinished = "provision.electron.finished" EventNameProvisionElectronMoved = "provision.electron.moved" EventNameProvisionElectronUnzipped = "provision.electron.unzipped" )
Provision 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 ( 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" EventNameWindowCmdMaximize = "window.cmd.maximize" EventNameWindowCmdMessage = "window.cmd.message" EventNameWindowCmdMinimize = "window.cmd.minimize" EventNameWindowCmdMove = "window.cmd.move" EventNameWindowCmdResize = "window.cmd.resize" 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" EventNameWindowEventMessage = "window.event.message" 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" )
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 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
Types ¶
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) 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) PrimaryDisplay ¶ added in v0.2.0
func (a *Astilectron) PrimaryDisplay() *Display
PrimaryDisplay returns the primary display
func (*Astilectron) SetProvisioner ¶
func (a *Astilectron) SetProvisioner(p Provisioner) *Astilectron
SetProvisioner sets the provisioner
type Disembedder ¶ added in v0.2.0
Disembedder is a functions that allows to disembed data from a path
type Dispatcher ¶ added in v0.3.0
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher represents an object capable of dispatching events
func (Dispatcher) Dispatch ¶ added in v0.3.0
func (d Dispatcher) Dispatch(e Event)
Dispatch dispatches an event
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.6.5/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 *int `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.6.5/docs/api/structures/display.md
type Event ¶
type Event struct { // This is the base of the event Name string `json:"name"` TargetID string `json:"targetID"` // 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 Displays *EventDisplays `json:"displays,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"` URL string `json:"url,omitempty"` WindowID string `json:"windowId,omitempty"` WindowOptions *WindowOptions `json:"windowOptions,omitempty"` }
Event represents an event
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 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 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.6.5/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 { // TODO Accelerator *string `json:"label,omitempty"` Checked *bool `json:"checked,omitempty"` Enabled *bool `json:"enabled,omitempty"` Icon *string `json:"icon,omitempty"` Label *string `json:"label,omitempty"` 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.6.5/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 Options ¶
type Options struct { AppName string AppIconDarwinPath string // Darwin systems requires a specific .icns file AppIconDefaultPath string BaseDirectoryPath 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) 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) 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 *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, d Dispatcher, appName, os 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 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 Window ¶
type Window struct {
// 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) OpenDevTools ¶
OpenDevTools opens the dev tools
func (*Window) Unmaximize ¶
Unmaximize unmaximize the window
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"` Width *int `json:"width,omitempty"` X *int `json:"x,omitempty"` Y *int `json:"y,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.6.5/docs/api/browser-window.md