Documentation ¶
Index ¶
- Constants
- Variables
- func Download(ctx context.Context, c *http.Client, dst, src string) (err error)
- func PtrBool(i bool) *bool
- func PtrInt(i int) *int
- func PtrStr(i string) *string
- func Unzip(ctx context.Context, dst, src string) error
- type Astilectron
- func (a *Astilectron) Close()
- func (a *Astilectron) HandleSignals()
- func (a *Astilectron) NewWindow(url string, o *WindowOptions) (w *Window, err error)
- func (a *Astilectron) On(eventName string, l Listener)
- func (a *Astilectron) SetProvisioner(p Provisioner) *Astilectron
- func (a *Astilectron) Start() (err error)
- func (a *Astilectron) Stop()
- func (a *Astilectron) Wait()
- type Event
- type EventMessage
- type Listener
- type Options
- type Paths
- 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) ElectronExecutable() string
- func (p *Paths) ElectronUnzipSrc() string
- func (p *Paths) VendorDirectory() string
- type Provisioner
- 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 (w *Window) Maximize() (err error)
- func (w *Window) Minimize() (err error)
- func (w *Window) Move(x, y int) (err error)
- func (w *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 ( EventNameAppEventReady = "app.event.ready" EventNameAppClose = "app.close" EventNameAppCrash = "app.crash" EventNameAppStop = "app.stop" // This event is equal to EventNameAppClose || EventNameAppCrash EventNameProvisionStart = "provision.start" EventNameProvisionDone = "provision.done" 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" )
Event names
Variables ¶
var DefaultProvisioner = &defaultProvisioner{ httpClient: &http.Client{}, }
Default provisioner
var (
ErrWindowDestroyed = errors.New("window.destroyed")
)
Window errors
Functions ¶
Types ¶
type Astilectron ¶
type Astilectron struct {
// contains filtered or unexported fields
}
Astilectron represents an object capable of interacting with Astilectron
func (*Astilectron) HandleSignals ¶
func (a *Astilectron) HandleSignals()
HandleSignals handles signals
func (*Astilectron) NewWindow ¶
func (a *Astilectron) NewWindow(url string, o *WindowOptions) (w *Window, err error)
NewWindow creates a new window
func (*Astilectron) On ¶
func (a *Astilectron) On(eventName string, l Listener)
On implements the Listenable interface
func (*Astilectron) SetProvisioner ¶
func (a *Astilectron) SetProvisioner(p Provisioner) *Astilectron
SetProvisioner sets the provisioner
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 Message *EventMessage `json:"message,omitempty"` URL string `json:"url,omitempty"` WindowOptions *WindowOptions `json:"windowOptions,omitempty"` }
Event represents an event
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 Options ¶
type Options struct {
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) 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) ElectronExecutable ¶
ElectronExecutable returns the electron eecutable path
func (*Paths) ElectronUnzipSrc ¶
ElectronUnzipSrc returns the electron unzip source path
func (*Paths) VendorDirectory ¶
BaseDirectory returns the vendor directory path
type Provisioner ¶
Provisioner represents an object capable of provisioning Astilectron
type Window ¶
type Window struct {
// contains filtered or unexported fields
}
Window represents a window https://github.com/electron/electron/blob/master/docs/api/browser-window.md 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) 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"` 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