Documentation
¶
Index ¶
- func CachedDir() (string, error)
- func EncodeStr(s string) []byte
- func EncodeU32U32(a, b uint32) []byte
- func EncodeWindowCreate(width, height int, debug bool, title string) []byte
- func EnsureRenderer(localPath string, prebuilt bool) (string, error)
- func EnsureWebView2() (string, error)
- func WriteFrame(w io.Writer, typ CmdByte, payload []byte) error
- type CmdByte
- type Config
- type Event
- type MessageHandler
- type Runtime
- type Transport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeU32U32 ¶
EncodeU32U32 returns two consecutive little-endian uint32 values.
func EncodeWindowCreate ¶
EncodeWindowCreate builds the WindowCreate payload.
width:u32 height:u32 debug:u8 title:str
func EnsureRenderer ¶
EnsureRenderer guarantees the renderer binary and its dependencies are present in the cache directory, returning the path to the executable.
func EnsureWebView2 ¶
EnsureWebView2 is a no-op on non-Windows platforms; WebView2 is Windows-only. Returns ("", nil) so call-sites need no platform guards.
Types ¶
type Config ¶
type Config struct {
Title string
Width int
Height int
Debug bool
Logging bool
RendererPath string
Prebuilt bool
OnReady func()
OnClose func() bool
}
Config holds the parameters used when starting a renderer process.
type MessageHandler ¶
MessageHandler is the internal callback type used by the ipc package.
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
Runtime manages a single renderer subprocess and its IPC connection. Each BrowserWindow owns exactly one Runtime.
func New ¶
New creates a Runtime for the given config. Does not spawn the renderer — call Run to do that. Cheap to call: no processes, no sockets, no I/O.
func (*Runtime) OffMessage ¶
OffMessage removes the handler for the named channel.
func (*Runtime) OnMessage ¶
func (rt *Runtime) OnMessage(channel string, h MessageHandler)
OnMessage registers an inbound message handler for the named channel.
func (*Runtime) Quit ¶
func (rt *Runtime) Quit()
Quit sends CmdQuit to the renderer and unblocks the event loop. Safe to call from any goroutine; idempotent.
type Transport ¶
type Transport struct {
ID string // the opaque random ID passed to the renderer via --channel
Path string // the full platform-specific socket/pipe path
// contains filtered or unexported fields
}
Transport is a connected net.Conn to the renderer process. On Linux/macOS it is a Unix socket; on Windows a named pipe.
func ListenTransport ¶
ListenTransport creates the server-side socket/pipe and returns a Transport whose Accept method blocks until the renderer connects.
func (*Transport) Accept ¶
Accept blocks until the renderer connects. The listener is intentionally left open until Close is called — on Windows, go-winio shares its IOCP completion port between the listener and any accepted connections, so closing the listener early silently breaks reads on the accepted connection.