Documentation
¶
Index ¶
- Constants
- Variables
- type Config
- func (m *Config) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *Config) CloneVT() *Config
- func (this *Config) EqualMessageVT(thatMsg any) bool
- func (this *Config) EqualVT(that *Config) bool
- func (c *Config) EqualsConfig(other config.Config) bool
- func (x *Config) GetAppName() string
- func (c *Config) GetConfigID() string
- func (x *Config) GetDevTools() bool
- func (x *Config) GetElectronFlags() []string
- func (x *Config) GetElectronPath() string
- func (x *Config) GetExternalLinks() ExternalLinks
- func (x *Config) GetQuitPolicy() QuitPolicy
- func (x *Config) GetRendererPath() string
- func (x *Config) GetThemeSource() string
- func (x *Config) GetWebRuntimeId() string
- func (x *Config) GetWindowHeight() uint32
- func (x *Config) GetWindowTitle() string
- func (x *Config) GetWindowWidth() uint32
- func (x *Config) GetWorkdirPath() string
- func (x *Config) MarshalJSON() ([]byte, error)
- func (x *Config) MarshalProtoJSON(s *json.MarshalState)
- func (x *Config) MarshalProtoText() string
- func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *Config) MarshalToVT(dAtA []byte) (int, error)
- func (m *Config) MarshalVT() (dAtA []byte, err error)
- func (*Config) ProtoMessage()
- func (x *Config) Reset()
- func (m *Config) SizeVT() (n int)
- func (x *Config) String() string
- func (x *Config) UnmarshalJSON(b []byte) error
- func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *Config) UnmarshalVT(dAtA []byte) error
- func (c *Config) Validate() error
- type Controller
- func (r *Controller) Close() error
- func (r *Controller) Execute(ctx context.Context) error
- func (r *Controller) GetBus() bus.Bus
- func (r *Controller) GetControllerInfo() *controller.Info
- func (r *Controller) GetLogger() *logrus.Entry
- func (r *Controller) HandleDirective(ctx context.Context, di directive.Instance) ([]directive.Resolver, error)
- func (r *Controller) WaitElectron(ctx context.Context, errCh <-chan error) (*Electron, error)
- type Electron
- type ElectronInit
- func (m *ElectronInit) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *ElectronInit) CloneVT() *ElectronInit
- func (this *ElectronInit) EqualMessageVT(thatMsg any) bool
- func (this *ElectronInit) EqualVT(that *ElectronInit) bool
- func (x *ElectronInit) GetAppName() string
- func (x *ElectronInit) GetDevTools() bool
- func (x *ElectronInit) GetExternalLinks() ExternalLinks
- func (x *ElectronInit) GetQuitPolicy() QuitPolicy
- func (x *ElectronInit) GetThemeSource() string
- func (x *ElectronInit) GetWindowHeight() uint32
- func (x *ElectronInit) GetWindowTitle() string
- func (x *ElectronInit) GetWindowWidth() uint32
- func (x *ElectronInit) MarshalJSON() ([]byte, error)
- func (x *ElectronInit) MarshalProtoJSON(s *json.MarshalState)
- func (x *ElectronInit) MarshalProtoText() string
- func (m *ElectronInit) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *ElectronInit) MarshalToVT(dAtA []byte) (int, error)
- func (m *ElectronInit) MarshalVT() (dAtA []byte, err error)
- func (*ElectronInit) ProtoMessage()
- func (x *ElectronInit) Reset()
- func (m *ElectronInit) SizeVT() (n int)
- func (x *ElectronInit) String() string
- func (x *ElectronInit) UnmarshalJSON(b []byte) error
- func (x *ElectronInit) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *ElectronInit) UnmarshalVT(dAtA []byte) error
- type ExternalLinks
- func (x ExternalLinks) Enum() *ExternalLinks
- func (x ExternalLinks) MarshalJSON() ([]byte, error)
- func (x ExternalLinks) MarshalProtoJSON(s *json.MarshalState)
- func (x ExternalLinks) MarshalProtoText() string
- func (x ExternalLinks) MarshalText() ([]byte, error)
- func (x ExternalLinks) String() string
- func (x *ExternalLinks) UnmarshalJSON(b []byte) error
- func (x *ExternalLinks) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (x *ExternalLinks) UnmarshalText(b []byte) error
- type Factory
- func (t *Factory) Construct(ctx context.Context, conf config.Config, opts controller.ConstructOpts) (controller.Controller, error)
- func (t *Factory) ConstructConfig() config.Config
- func (t *Factory) GetConfigID() string
- func (t *Factory) GetControllerID() string
- func (t *Factory) GetVersion() semver.Version
- type QuitPolicy
- func (x QuitPolicy) Enum() *QuitPolicy
- func (x QuitPolicy) MarshalJSON() ([]byte, error)
- func (x QuitPolicy) MarshalProtoJSON(s *json.MarshalState)
- func (x QuitPolicy) MarshalProtoText() string
- func (x QuitPolicy) MarshalText() ([]byte, error)
- func (x QuitPolicy) String() string
- func (x *QuitPolicy) UnmarshalJSON(b []byte) error
- func (x *QuitPolicy) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (x *QuitPolicy) UnmarshalText(b []byte) error
Constants ¶
const ConfigID = ControllerID
ConfigID is the string used to identify this config object.
const ControllerID = "bldr/web/plugin/electron"
ControllerID is the browser runtime controller ID.
const RuntimeID = "electron"
RuntimeID is the runtime identifier
Variables ¶
var ( ExternalLinks_name = map[int32]string{ 0: "EXTERNAL_LINKS_OS_BROWSER", 1: "EXTERNAL_LINKS_DENY", } ExternalLinks_value = map[string]int32{ "EXTERNAL_LINKS_OS_BROWSER": 0, "EXTERNAL_LINKS_DENY": 1, } )
Enum value maps for ExternalLinks.
var ( QuitPolicy_name = map[int32]string{ 0: "QUIT_POLICY_UNSPECIFIED", 1: "QUIT_POLICY_RESTART", 2: "QUIT_POLICY_EXIT", } QuitPolicy_value = map[string]int32{ "QUIT_POLICY_UNSPECIFIED": 0, "QUIT_POLICY_RESTART": 1, "QUIT_POLICY_EXIT": 2, } )
Enum value maps for QuitPolicy.
var Version = semver.MustParse("0.0.1")
Version is the API version.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// ElectronPath is the path to the electron binary.
ElectronPath string `protobuf:"bytes,1,opt,name=electron_path,json=electronPath,proto3" json:"electronPath,omitempty"`
// WorkdirPath is the path to the working directory to use.
// If unset, defaults to the current working directory of the process.
WorkdirPath string `protobuf:"bytes,5,opt,name=workdir_path,json=workdirPath,proto3" json:"workdirPath,omitempty"`
// RendererPath is the path to the renderer bundle.
// Must be one of the accepted Electron path types.
// Ex: http://, file://, path to directory, path to index.js
// Relative paths must be relative to workdir_path.
RendererPath string `protobuf:"bytes,2,opt,name=renderer_path,json=rendererPath,proto3" json:"rendererPath,omitempty"`
// WebRuntimeId is the value to use for the runtime uuid.
// Used for the Unix pipe paths and for the BroadcastChannel ids.
// Should be unique against other running Electron instances.
WebRuntimeId string `protobuf:"bytes,3,opt,name=web_runtime_id,json=webRuntimeId,proto3" json:"webRuntimeId,omitempty"`
// ElectronFlags are additional flags to pass to electron.
ElectronFlags []string `protobuf:"bytes,4,rep,name=electron_flags,json=electronFlags,proto3" json:"electronFlags,omitempty"`
// ExternalLinks configures how external links are handled.
ExternalLinks ExternalLinks `protobuf:"varint,6,opt,name=external_links,json=externalLinks,proto3" json:"externalLinks,omitempty"`
// AppName is the application display name.
AppName string `protobuf:"bytes,7,opt,name=app_name,json=appName,proto3" json:"appName,omitempty"`
// WindowTitle overrides the window title (defaults to app_name).
WindowTitle string `protobuf:"bytes,8,opt,name=window_title,json=windowTitle,proto3" json:"windowTitle,omitempty"`
// WindowWidth is the default window width in pixels.
WindowWidth uint32 `protobuf:"varint,9,opt,name=window_width,json=windowWidth,proto3" json:"windowWidth,omitempty"`
// WindowHeight is the default window height in pixels.
WindowHeight uint32 `protobuf:"varint,10,opt,name=window_height,json=windowHeight,proto3" json:"windowHeight,omitempty"`
// DevTools enables DevTools on window creation.
DevTools bool `protobuf:"varint,11,opt,name=dev_tools,json=devTools,proto3" json:"devTools,omitempty"`
// ThemeSource sets native theme ("dark", "light", "system").
ThemeSource string `protobuf:"bytes,12,opt,name=theme_source,json=themeSource,proto3" json:"themeSource,omitempty"`
// QuitPolicy configures whether user quit should restart or exit.
QuitPolicy QuitPolicy `protobuf:"varint,13,opt,name=quit_policy,json=quitPolicy,proto3" json:"quitPolicy,omitempty"`
// contains filtered or unexported fields
}
Config is the configuration for the electron runtime.
func (*Config) CloneMessageVT ¶
func (m *Config) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*Config) EqualMessageVT ¶
func (*Config) EqualsConfig ¶
EqualsConfig checks if the other config is equal.
func (*Config) GetAppName ¶
func (*Config) GetConfigID ¶
GetConfigID returns the unique string for this configuration type.
func (*Config) GetDevTools ¶
func (*Config) GetElectronFlags ¶
func (*Config) GetElectronPath ¶
func (*Config) GetExternalLinks ¶
func (x *Config) GetExternalLinks() ExternalLinks
func (*Config) GetQuitPolicy ¶
func (x *Config) GetQuitPolicy() QuitPolicy
func (*Config) GetRendererPath ¶
func (*Config) GetThemeSource ¶
func (*Config) GetWebRuntimeId ¶
func (*Config) GetWindowHeight ¶
func (*Config) GetWindowTitle ¶
func (*Config) GetWindowWidth ¶
func (*Config) GetWorkdirPath ¶
func (*Config) MarshalJSON ¶
MarshalJSON marshals the Config to JSON.
func (*Config) MarshalProtoJSON ¶
func (x *Config) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the Config message to JSON.
func (*Config) MarshalProtoText ¶
func (*Config) MarshalToSizedBufferVT ¶
func (*Config) ProtoMessage ¶
func (*Config) ProtoMessage()
func (*Config) UnmarshalJSON ¶
UnmarshalJSON unmarshals the Config from JSON.
func (*Config) UnmarshalProtoJSON ¶
func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the Config message from JSON.
func (*Config) UnmarshalVT ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller is the electron runtime controller.
Communicates with the electron Renderer via IPC.
func NewController ¶
func NewController( le *logrus.Entry, b bus.Bus, electronPath, workdirPath, rendererPath, runtimeUuid string, extraElectronArgs []string, electronInit *ElectronInit, ) (*Controller, error)
NewController constructs a new browser runtime which starts Electron. sessionUuid is used to make the unix pipe path unique.
func (*Controller) Execute ¶
func (r *Controller) Execute(ctx context.Context) error
Execute executes the runtime. Returns any errors, nil if Execute is not required.
func (*Controller) GetBus ¶
func (r *Controller) GetBus() bus.Bus
GetBus returns the root controller bus to use in this process.
func (*Controller) GetControllerInfo ¶
func (r *Controller) GetControllerInfo() *controller.Info
GetControllerInfo returns information about the controller.
func (*Controller) GetLogger ¶
func (r *Controller) GetLogger() *logrus.Entry
GetLogger returns the root log entry.
func (*Controller) HandleDirective ¶
func (r *Controller) HandleDirective(ctx context.Context, di directive.Instance) ([]directive.Resolver, error)
HandleDirective asks if the handler can resolve the directive.
func (*Controller) WaitElectron ¶
WaitElectron waits for the Electron object to be ready and returns it. if errCh is set, checks it for errors to return early.
type Electron ¶
type Electron struct {
// contains filtered or unexported fields
}
Electron is a running instance of Electron.
func RunElectron ¶
func RunElectron( ctx context.Context, le *logrus.Entry, electronPath, workdirPath, rendererPath, runtimeUuid string, extraElectronFlags []string, electronInit *ElectronInit, ) (*Electron, error)
RunElectron listens on the IPC pipe and starts Electron sub-process.
func (*Electron) GetMuxedConn ¶
GetMuxedConn returns the muxed conn with the main process.
type ElectronInit ¶
type ElectronInit struct {
// ExternalLinks configures how external links are handled.
ExternalLinks ExternalLinks `protobuf:"varint,1,opt,name=external_links,json=externalLinks,proto3" json:"externalLinks,omitempty"`
// AppName is the application display name.
AppName string `protobuf:"bytes,2,opt,name=app_name,json=appName,proto3" json:"appName,omitempty"`
// WindowTitle overrides the window title (defaults to app_name).
WindowTitle string `protobuf:"bytes,3,opt,name=window_title,json=windowTitle,proto3" json:"windowTitle,omitempty"`
// WindowWidth is the default window width in pixels (default: 900).
WindowWidth uint32 `protobuf:"varint,4,opt,name=window_width,json=windowWidth,proto3" json:"windowWidth,omitempty"`
// WindowHeight is the default window height in pixels (default: 680).
WindowHeight uint32 `protobuf:"varint,5,opt,name=window_height,json=windowHeight,proto3" json:"windowHeight,omitempty"`
// DevTools enables DevTools on window creation (default: false).
DevTools bool `protobuf:"varint,6,opt,name=dev_tools,json=devTools,proto3" json:"devTools,omitempty"`
// ThemeSource sets native theme ("dark", "light", "system").
ThemeSource string `protobuf:"bytes,7,opt,name=theme_source,json=themeSource,proto3" json:"themeSource,omitempty"`
// QuitPolicy configures whether user quit should restart or exit.
QuitPolicy QuitPolicy `protobuf:"varint,8,opt,name=quit_policy,json=quitPolicy,proto3" json:"quitPolicy,omitempty"`
// contains filtered or unexported fields
}
ElectronInit is passed from Go to the Electron main process on startup.
func (*ElectronInit) CloneMessageVT ¶
func (m *ElectronInit) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*ElectronInit) CloneVT ¶
func (m *ElectronInit) CloneVT() *ElectronInit
func (*ElectronInit) EqualMessageVT ¶
func (this *ElectronInit) EqualMessageVT(thatMsg any) bool
func (*ElectronInit) EqualVT ¶
func (this *ElectronInit) EqualVT(that *ElectronInit) bool
func (*ElectronInit) GetAppName ¶
func (x *ElectronInit) GetAppName() string
func (*ElectronInit) GetDevTools ¶
func (x *ElectronInit) GetDevTools() bool
func (*ElectronInit) GetExternalLinks ¶
func (x *ElectronInit) GetExternalLinks() ExternalLinks
func (*ElectronInit) GetQuitPolicy ¶
func (x *ElectronInit) GetQuitPolicy() QuitPolicy
func (*ElectronInit) GetThemeSource ¶
func (x *ElectronInit) GetThemeSource() string
func (*ElectronInit) GetWindowHeight ¶
func (x *ElectronInit) GetWindowHeight() uint32
func (*ElectronInit) GetWindowTitle ¶
func (x *ElectronInit) GetWindowTitle() string
func (*ElectronInit) GetWindowWidth ¶
func (x *ElectronInit) GetWindowWidth() uint32
func (*ElectronInit) MarshalJSON ¶
func (x *ElectronInit) MarshalJSON() ([]byte, error)
MarshalJSON marshals the ElectronInit to JSON.
func (*ElectronInit) MarshalProtoJSON ¶
func (x *ElectronInit) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the ElectronInit message to JSON.
func (*ElectronInit) MarshalProtoText ¶
func (x *ElectronInit) MarshalProtoText() string
func (*ElectronInit) MarshalToSizedBufferVT ¶
func (m *ElectronInit) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*ElectronInit) MarshalToVT ¶
func (m *ElectronInit) MarshalToVT(dAtA []byte) (int, error)
func (*ElectronInit) MarshalVT ¶
func (m *ElectronInit) MarshalVT() (dAtA []byte, err error)
func (*ElectronInit) ProtoMessage ¶
func (*ElectronInit) ProtoMessage()
func (*ElectronInit) Reset ¶
func (x *ElectronInit) Reset()
func (*ElectronInit) SizeVT ¶
func (m *ElectronInit) SizeVT() (n int)
func (*ElectronInit) String ¶
func (x *ElectronInit) String() string
func (*ElectronInit) UnmarshalJSON ¶
func (x *ElectronInit) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the ElectronInit from JSON.
func (*ElectronInit) UnmarshalProtoJSON ¶
func (x *ElectronInit) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the ElectronInit message from JSON.
func (*ElectronInit) UnmarshalVT ¶
func (m *ElectronInit) UnmarshalVT(dAtA []byte) error
type ExternalLinks ¶
type ExternalLinks int32
ExternalLinks configures how external links are handled.
const ( // EXTERNAL_LINKS_OS_BROWSER opens external links in the OS default browser. ExternalLinks_EXTERNAL_LINKS_OS_BROWSER ExternalLinks = 0 // EXTERNAL_LINKS_DENY denies all external link navigation. ExternalLinks_EXTERNAL_LINKS_DENY ExternalLinks = 1 )
func (ExternalLinks) Enum ¶
func (x ExternalLinks) Enum() *ExternalLinks
func (ExternalLinks) MarshalJSON ¶
func (x ExternalLinks) MarshalJSON() ([]byte, error)
MarshalJSON marshals the ExternalLinks to JSON.
func (ExternalLinks) MarshalProtoJSON ¶
func (x ExternalLinks) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the ExternalLinks to JSON.
func (ExternalLinks) MarshalProtoText ¶
func (x ExternalLinks) MarshalProtoText() string
func (ExternalLinks) MarshalText ¶
func (x ExternalLinks) MarshalText() ([]byte, error)
MarshalText marshals the ExternalLinks to text.
func (ExternalLinks) String ¶
func (x ExternalLinks) String() string
func (*ExternalLinks) UnmarshalJSON ¶
func (x *ExternalLinks) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the ExternalLinks from JSON.
func (*ExternalLinks) UnmarshalProtoJSON ¶
func (x *ExternalLinks) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the ExternalLinks from JSON.
func (*ExternalLinks) UnmarshalText ¶
func (x *ExternalLinks) UnmarshalText(b []byte) error
UnmarshalText unmarshals the ExternalLinks from text.
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
Factory constructs a Electron runtime controller.
func NewFactory ¶
NewFactory builds a Browser runtime factory.
func (*Factory) Construct ¶
func (t *Factory) Construct( ctx context.Context, conf config.Config, opts controller.ConstructOpts, ) (controller.Controller, error)
Construct constructs the associated controller given configuration.
func (*Factory) ConstructConfig ¶
ConstructConfig constructs an instance of the controller configuration.
func (*Factory) GetConfigID ¶
GetConfigID returns the configuration ID for the controller.
func (*Factory) GetControllerID ¶
GetControllerID returns the unique ID for the controller.
func (*Factory) GetVersion ¶
GetVersion returns the version of this controller.
type QuitPolicy ¶
type QuitPolicy int32
QuitPolicy configures how the Electron runtime behaves on user quit.
const ( // QUIT_POLICY_UNSPECIFIED lets the caller choose the runtime default. QuitPolicy_QUIT_POLICY_UNSPECIFIED QuitPolicy = 0 // QUIT_POLICY_RESTART keeps the host restart-friendly after user quit. QuitPolicy_QUIT_POLICY_RESTART QuitPolicy = 1 // QUIT_POLICY_EXIT exits cleanly without restart after user quit. QuitPolicy_QUIT_POLICY_EXIT QuitPolicy = 2 )
func (QuitPolicy) Enum ¶
func (x QuitPolicy) Enum() *QuitPolicy
func (QuitPolicy) MarshalJSON ¶
func (x QuitPolicy) MarshalJSON() ([]byte, error)
MarshalJSON marshals the QuitPolicy to JSON.
func (QuitPolicy) MarshalProtoJSON ¶
func (x QuitPolicy) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the QuitPolicy to JSON.
func (QuitPolicy) MarshalProtoText ¶
func (x QuitPolicy) MarshalProtoText() string
func (QuitPolicy) MarshalText ¶
func (x QuitPolicy) MarshalText() ([]byte, error)
MarshalText marshals the QuitPolicy to text.
func (QuitPolicy) String ¶
func (x QuitPolicy) String() string
func (*QuitPolicy) UnmarshalJSON ¶
func (x *QuitPolicy) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the QuitPolicy from JSON.
func (*QuitPolicy) UnmarshalProtoJSON ¶
func (x *QuitPolicy) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the QuitPolicy from JSON.
func (*QuitPolicy) UnmarshalText ¶
func (x *QuitPolicy) UnmarshalText(b []byte) error
UnmarshalText unmarshals the QuitPolicy from text.