Documentation
¶
Index ¶
- Variables
- func AppWindow(opts AppOptions) error
- func BindMethods(w WebView, prefix string, obj any) ([]string, error)
- func Init() error
- func RenderHTML(tpl *template.Template, name string, data any) (string, error)
- func SetAppIcon(png []byte) error
- type AppOptions
- type AppReadyInfo
- type AppTransport
- type EventHandler
- type Events
- type FileDialogOptions
- type FileFilter
- type Hint
- type NavigationEvent
- type NavigationKind
- type Options
- type SchemeHandler
- type SchemeRequest
- type SchemeResponse
- type ScriptDialog
- type ScriptDialogKind
- type Snapshotter
- type WebView
Constants ¶
This section is empty.
Variables ¶
var ErrBridgeDisabled = errors.New("webview: bridge disabled (Options.NoBridge)")
ErrBridgeDisabled is returned by Bind and Unbind on a web view created with Options.NoBridge.
var ErrHiddenWindow = errors.New("webview: Options.Hidden cannot be combined with Options.Window")
ErrHiddenWindow is returned by NewWithOptions when Options.Hidden is combined with Options.Window.
var ErrIconUnsupported = fmt.Errorf( "glaze: setting the application icon at runtime is not supported on this platform: %w", errors.ErrUnsupported)
ErrIconUnsupported is returned where the platform has no application-level icon to set at runtime — on Windows and Linux the icon comes from the executable's resources or the desktop entry, both decided before the process exists.
It wraps the standard errors.ErrUnsupported. Windows and Linux are the platforms where this is returned, which is to say the common case is a correct program on a correct platform: it must not need a glaze-specific sentinel to be told apart from a real failure. errors.Is against this variable still matches, as before.
Functions ¶
func AppWindow ¶
func AppWindow(opts AppOptions) error
AppWindow creates a native window backed by a local HTTP server.
It starts the server on a random loopback port (or the address specified in opts.Addr), opens a webview pointing to it, and runs the UI event loop. When the user closes the window, the server is shut down and AppWindow returns.
This is the recommended way to wrap a full devengine application as a desktop app — pass the configured http.ServeMux as opts.Handler and everything (templates, assets, routes) works unmodified.
func BindMethods ¶
BindMethods binds all exported methods of obj as JavaScript functions. Each method is exposed as window.{prefix}_{MethodName}(args...). Methods must follow the same signature rules as Bind:
- Return either nothing, a value, an error, or (value, error).
Returns the list of bound function names and the first error encountered.
func Init ¶
func Init() error
Init loads the system GTK + WebKitGTK libraries and resolves all symbols. Safe to call multiple times; New calls it.
func RenderHTML ¶
RenderHTML executes a named template to a string, suitable for SetHtml(). This allows reusing Go html/template definitions without an HTTP server.
func SetAppIcon ¶
SetAppIcon gives the running application the icon in png — the picture the Dock, the taskbar or the switcher shows for the PROCESS, which is a different thing from the icon baked into the executable file.
It is application-wide, not per window, because that is what every platform that has the concept models: a process has one face. It is also why this is a package function rather than a WebView method — a program with no webview at all (a game window, a headless helper that raises a dialog) wants it just as much.
Where a platform has no such concept, it reports ErrIconUnsupported, which callers are expected to log and carry on: an application that refuses to start because it could not wear its own icon is worse than a plain one.
Types ¶
type AppOptions ¶
type AppOptions struct {
// Title is the window title.
Title string
// Width and Height set the initial window dimensions.
Width int
Height int
// Hint controls window resize behaviour (HintNone, HintMin, HintMax, HintFixed).
Hint Hint
// Debug enables the browser developer tools.
Debug bool
// Transport selects the backend transport.
// Defaults to AppTransportAuto.
Transport AppTransport
// Addr is the listen address for the local HTTP server.
// Used by AppTransportTCP and defaults to "127.0.0.1:0".
Addr string
// UnixSocketPath is an optional socket path used when Transport is unix.
// If empty, a temporary socket path is generated automatically.
UnixSocketPath string
// Handler is the HTTP handler to serve (typically an http.ServeMux).
Handler http.Handler
// OnReady is called once listeners are up, with the navigable base URL.
// Use it to log the address or perform additional setup.
OnReady func(addr string)
// OnReadyInfo is called once listeners are up, with transport details.
// This is useful to inspect whether backend transport is tcp or unix.
OnReadyInfo func(info AppReadyInfo)
}
AppOptions configures an AppWindow.
type AppReadyInfo ¶
type AppReadyInfo struct {
// URL is the navigable URL used by the embedded browser.
URL string
// Transport is the resolved backend transport in use.
Transport AppTransport
// Backend is the backend listener endpoint.
// - tcp: "ip:port"
// - unix: "/path/to/socket"
Backend string
// Gateway is the loopback gateway endpoint when unix transport is used.
// For tcp transport this matches Backend.
Gateway string
}
AppReadyInfo contains transport details once AppWindow listeners are ready.
type AppTransport ¶
type AppTransport string
AppTransport selects how AppWindow serves HTTP to the embedded browser.
const ( // AppTransportAuto chooses the recommended platform default. // - macOS/Linux: unix backend socket with loopback HTTP gateway. // - Windows: loopback TCP. AppTransportAuto AppTransport = "auto" // AppTransportTCP serves directly over loopback TCP. AppTransportTCP AppTransport = "tcp" // AppTransportUnix serves the application handler over a Unix domain socket. // A lightweight loopback HTTP gateway is created so the embedded browser can // still navigate with a standard http:// URL. AppTransportUnix AppTransport = "unix" )
type EventHandler ¶
type EventHandler func(args ...json.RawMessage)
EventHandler receives the event's arguments, each as the raw JSON the emitter sent, to unmarshal into whatever type the handler expects.
type Events ¶
type Events struct {
// contains filtered or unexported fields
}
Events is a lightweight publish/subscribe bridge between Go and JavaScript, layered entirely on the public Bind/Init/Eval primitives (no extra native code). Create one per WebView with NewEvents, then Emit and subscribe on either side: an event reaches every listener on both sides exactly once, and neither side echoes back to create a loop.
The matching JavaScript API is installed on the page as window.glaze.events:
glaze.events.on("app:ready", (info) => { ... });
glaze.events.emit("ui:save", "untitled.txt");
Events is safe for concurrent use.
func NewEvents ¶
NewEvents installs the events bridge on w and returns the handle used to emit and subscribe from Go. Call it once per WebView, before Run. The error is non-nil only if the underlying Bind fails.
func (*Events) Emit ¶
Emit publishes an event to every listener on both sides. Each value in data becomes one argument delivered to the handlers (Go handlers receive it as raw JSON, JS handlers as a decoded value). It is safe to call from any goroutine; the JS-side listeners are notified on the UI thread. Emit returns an error only if a value in data cannot be JSON-encoded, in which case nothing is published.
func (*Events) On ¶
func (e *Events) On(name string, handler EventHandler) (cancel func())
On subscribes handler to the named event and returns a function that cancels just this subscription. Handlers for a JS-originated event run on the binding goroutine; handlers for a Go-originated event run on the goroutine that called Emit. Re-enter the UI thread with Dispatch if a handler touches the window.
type FileDialogOptions ¶
type FileDialogOptions struct {
// Title overrides the dialog's title.
Title string
// Directory is the initial directory the dialog displays, as a filesystem
// path. Empty uses the platform default (usually the last-used directory).
Directory string
// Filename is the suggested file name. It is used by SaveFile and ignored
// by the open and directory dialogs.
Filename string
// Filters limits the selectable file types. An empty list shows all files.
// Filters are advisory: a platform may present them differently or let the
// user override them.
Filters []FileFilter
}
FileDialogOptions configures a native file dialog. The zero value is valid: it shows a default dialog rooted at the platform's default directory with no type filtering.
type FileFilter ¶
type FileFilter struct {
// Name is the human-readable label for this filter (e.g. "Images").
Name string
// Extensions lists the file extensions WITHOUT the leading dot
// (e.g. {"png", "jpg"}). An empty list, or an entry "*", matches any file.
Extensions []string
}
FileFilter restricts a file dialog to files of a given kind.
type NavigationEvent ¶
type NavigationEvent struct {
}
NavigationEvent reports the end of a main-frame navigation. Err is set only for NavigationFailed; URL is empty when the engine does not know it. TLS marks a failure of the secure connection, such as an untrusted, expired or mismatched certificate. A navigation cancelled because another replaced it is not a failure and is not reported.
type NavigationKind ¶
type NavigationKind int
NavigationKind says how a main-frame navigation ended.
const ( )
type Options ¶
type Options struct {
// Debug enables the platform web inspector / dev tools.
Debug bool
// Window, if non-nil, is an existing native window to embed into (a
// GtkWindow* / NSWindow* / HWND), mirroring NewWindow.
Window unsafe.Pointer
// SchemeHandlers maps a scheme name (without "://", e.g. "app") to its
// handler, registered as a secure context. Handlers must be installed before
// the web view is created, so they cannot be added later.
SchemeHandlers map[string]SchemeHandler
// AcceptsFirstMouse makes a click on an INACTIVE window reach the page
// instead of only bringing the window forward.
//
// macOS only; ignored elsewhere, where a click on an inactive window already
// reaches the content. AppKit's default is the opposite of what most web UIs
// want: the first click is swallowed as activation, so a user who clicks a
// button in a window that lost focus has to click twice — and the first
// click looks broken. Turn this on for control panels, dashboards, players
// and anything else the user clicks in passing.
//
// It is OPT-IN because the default protects destructive interfaces: in a
// drawing tool, an editor, or any window with a delete button, a click that
// merely raises the window must NOT also press what happens to be under the
// cursor. Leave it off when a stray first click could destroy something.
AcceptsFirstMouse bool
// NoBridge leaves out the JS<->Go bridge: no window.__webview__ and no
// native message handler, so the page has no channel back to the process.
// Bind and Unbind then return ErrBridgeDisabled; Init and Eval still work.
// Use it when the web view loads content the app does not control: on
// Linux it also denies the page script access to the clipboard (macOS
// denies it by default).
NoBridge bool
// HideUntilLoaded keeps the web view hidden until the first page can be
// drawn, so the window shows its native background instead of flashing an
// empty white page. On Linux that is when the navigation commits: WebKitGTK
// paints nothing until the page does, so the page shows as it paints. On
// macOS it is the page's first contentful paint, because WKWebView paints
// white between the commit and then; without that signal (before macOS
// 11), when the navigation ends. Clicks and keys wait for the page to
// show. Ignored on Windows.
HideUntilLoaded bool
// finishes or fails. macOS and Linux; never called on Windows.
OnNavigation func(NavigationEvent)
// navigation starts, with the URL requested; a redirect is not a new
// start. The navigation then ends in OnNavigation, unless it is cancelled
// (replaced by another, stopped, or turned into a download), which is not
// reported. macOS and Linux; never called on Windows.
OnNavigationStart func(url string)
// OnURLChange is called on the UI thread with the URL of the page on
// screen each time it changes: when a navigation commits a new document
// (after any redirect, long before the load finishes), and when the page
// moves its URL without loading -- history.pushState or replaceState, a
// fragment link, back or forward within the same document. A navigation
// that fails or is cancelled before committing leaves the page, and its
// URL, as they were. macOS and Linux; never called on Windows.
OnURLChange func(url string)
// OnScriptDialog shows a page's alert(), confirm() or prompt() and returns
// the answer: ok for OK (confirm, prompt) and the text typed (prompt). The
// page waits for it. Without it the engines differ, as they always have:
// macOS answers as if dismissed (the alert vanishes, confirm is false,
// prompt null) and Linux shows WebKitGTK's own dialog. With it, a page
// leaving with an onbeforeunload handler on Linux just leaves, as on macOS.
// Called on the UI thread; may run a modal dialog. macOS and Linux; never
// called on Windows.
OnScriptDialog func(d ScriptDialog) (ok bool, text string)
// OnContentShown is called on the UI thread when HideUntilLoaded shows
// the web view (see there for when that is). Only with HideUntilLoaded.
// macOS and Linux; never called on Windows.
OnContentShown func()
// OnNewWindow receives the URL of a page's request for a new window (a
// target=_blank link, window.open). glaze never opens the window itself,
// with or without a handler: the request is dropped and the page's
// window.open returns null. Popups without a user gesture are blocked by
// the engine before they get here. Called on the UI thread. macOS and
// Linux; never called on Windows.
OnNewWindow func(url string)
// OnClose is called on the UI thread when the person closes the window
// (its close button, Alt+F4, Cmd-W), once the window is gone; never after
// Destroy. With several windows it is how the app learns that one of
// them closed: Run returns for the last window only on Windows, and for
// the window it was called on only on Linux. Call Destroy afterwards to
// release the web view.
OnClose func()
// OnDownload decides where a download the page starts (an attachment, a
// file the view cannot show, a link with the download attribute) is
// saved: it gets the suggested file name and returns the destination
// path, or "" to cancel. An existing file there is replaced -- the app is
// expected to have asked (a save panel does). Without OnDownload every
// download is cancelled; nothing is ever saved on the engine's own
// initiative. Called on the UI thread; may run a modal dialog. macOS and
// Linux; downloads are left to the engine on Windows.
OnDownload func(suggestedName string) (path string)
// OnDownloadDone reports a download OnDownload accepted: saved at path,
// or failed with err.
OnDownloadDone func(path string, err error)
// OnOpenURLs receives the URLs the system asks the app to open: a link
// clicked in another app while this one is the chosen handler for its
// scheme (the app declares the scheme in its Info.plist). When the
// system launches the app to open a URL, the call comes while
// NewWithOptions is still starting the application, before it returns.
// It is an application event, not a window's: the handler of the last
// NewWithOptions that set one gets every URL. It reaches glaze only when
// glaze started the application (not under another run loop's owner).
// Called on the UI thread. macOS only: elsewhere the URL comes as a
// command-line argument.
OnOpenURLs func(urls []string)
// OnMediaCapture decides whether the page from origin (scheme://host[:port])
// may use the camera, the microphone or both. origin is always the
// top-level page's: a frame from another origin reaches here only when
// that page delegates the device to it (<iframe allow="camera">), and the
// engine denies it otherwise, so the page answers for its frames, as in
// the major browsers' permission delegation. Without it every request is
// denied, as are other permissions (geolocation, notifications). A grant
// also lets that page learn the devices' names, until it navigates away. On Linux, setting it also
// turns on media streams and WebRTC, which WebKitGTK leaves off. macOS
// asks the user once more on its own and needs NSCameraUsageDescription
// and NSMicrophoneUsageDescription in the app's Info.plist (and, when
// sandboxed, the device.camera and device.audio-input entitlements), or
// the system ends the app. Called on the UI thread; may run a modal
// dialog. macOS 12+ and Linux; never called on Windows.
OnMediaCapture func(origin string, camera, microphone bool) bool
// SandboxWebContent runs page content in WebKitGTK's bubblewrap sandbox
// on Linux with WebKitGTK 4.1 (GTK3), where it is off unless asked for:
// for an app that shows pages it does not control. It needs bwrap
// installed, and stays off without it, as WebKit could not start the
// page's process otherwise. WebKitGTK 6.0 (GTK4) always sandboxes, and so
// does macOS; ignored there and on Windows. The first web view decides for
// the process's shared context.
SandboxWebContent bool
// fingers sideways go back and forward, as in Safari. Off by default: in
// an app with routes of its own a swipe would move between them. macOS and
// Linux (WebKitGTK 2.24 and later); ignored on Windows.
NavigationGestures bool
// FrameAutosaveName, on macOS, makes the window remember its size and
// position under this name: the first SetSize gives the size only when
// nothing is saved yet. A window opened while other instances of the same
// app are running is moved down and right of where it would go, so it does
// not hide theirs, and leaves the saved frame alone. Ignored elsewhere.
FrameAutosaveName string
// Ephemeral keeps the web view's website data -- cookies, local storage,
// cache -- in memory only: it starts with nothing from earlier runs and
// leaves nothing behind. Each ephemeral web view gets its own store.
// macOS and Linux; ignored on Windows.
Ephemeral bool
// Hidden makes a headless web view: it keeps its native window and event
// loop, but the window is never shown -- not at creation, while loading,
// on SetSize, or in Run -- and the app is not activated for it. Focus and
// Raise do nothing. SetSize still sizes the page's viewport (on Linux,
// only with DisableThrottling; see below). Content loads and runs
// normally, so HideUntilLoaded is ignored. It cannot be combined with
// Window: an existing window's visibility belongs to its owner. On macOS a
// process whose only web views are hidden runs without a Dock icon.
// WebKit throttles a page whose window is not on screen, on macOS and
// Linux alike; see DisableThrottling. On Windows a hidden page is not
// throttled: it reports itself visible and runs at full speed, animation
// frames included, with or without DisableThrottling. Linux still needs a
// display session (X11 or Wayland; Xvfb or a headless compositor such as
// weston --backend=headless will do), and without DisableThrottling a
// hidden page there sees a 0x0 viewport, since its window is never mapped.
Hidden bool
// DisableThrottling keeps the page running at full speed while the
// window is inactive, covered or hidden. For pages doing continuous work
// in the background; it costs battery.
//
// On macOS it opts the process out of App Nap (for the rest of its life,
// once any web view asks) and turns off WebKit's occlusion detection,
// hidden-page timer throttling and hidden-page process suppression. The
// WebKit settings are private API, each applied only if this macOS has
// it. With Hidden, the window is put on screen fully transparent and
// click-through instead of left off it.
//
// On Linux it is complete only with Hidden. It turns off WebKitGTK's
// hidden-page timer throttling and CSS animation suspension (WebKitGTK
// 2.42 or later), which alone keeps timers at full speed but not
// requestAnimationFrame. With Hidden, the window is also mapped without
// appearing on screen, so the page is visible to WebKit: an offscreen
// window on GTK3, which the first such web view in a process therefore
// prefers when both stacks are installed, and otherwise (GTK4, or
// WebKitGTK 2.48.0 to 2.48.3, which crash in an offscreen window) a fully
// transparent, undecorated, click-through window that is never presented
// or focused. On GTK4 that window can still take focus and appear in the
// task switcher on some desktops; under Xvfb or a headless compositor
// neither matters. Without Hidden it is best effort: a minimized or
// covered window keeps its timers, but not animation frames.
//
// On Windows only a minimized window is throttled, because its web view is
// sized to nothing. With DisableThrottling the web view keeps its last
// size instead, so the page keeps running at full speed and reports
// itself visible. A Hidden web view is never throttled.
DisableThrottling bool
}
Options configures a web view created with NewWithOptions.
type SchemeHandler ¶
type SchemeHandler func(*SchemeRequest) *SchemeResponse
SchemeHandler serves responses for one registered scheme. It runs on the UI thread, so keep it fast (serve from an in-memory FS).
type SchemeRequest ¶
type SchemeRequest struct {
// URL is the full request URL, e.g. "app://host/index.html".
URL string
}
SchemeRequest describes an incoming request for a registered custom scheme.
type SchemeResponse ¶
type SchemeResponse struct {
// Body is the response payload. The backend copies or streams it before the
// handler returns, so it need not outlive the call.
Body []byte
// MIMEType defaults to "application/octet-stream" when empty.
MIMEType string
}
SchemeResponse is what a SchemeHandler returns for a request. A nil response is treated as "not found".
type ScriptDialog ¶
type ScriptDialog struct {
Kind ScriptDialogKind
Message string
Text string
}
ScriptDialog is a page's alert(), confirm() or prompt(): Message is what the page says, Text the prompt's default answer.
type ScriptDialogKind ¶
type ScriptDialogKind int
ScriptDialogKind is which of a page's script dialogs is asked for.
const ( ScriptAlert ScriptDialogKind = iota ScriptConfirm ScriptPrompt )
type Snapshotter ¶
type Snapshotter interface {
// Snapshot returns the current page as PNG bytes. It must be called from a
// goroutine that is not the UI thread: the capture completes on the main
// queue, so blocking the main thread would deadlock until the timeout.
Snapshot() ([]byte, error)
}
Snapshotter is implemented by backends that can rasterize the page they are showing. It is deliberately a side interface rather than a method on WebView: adding it there would force every backend to implement it, and the backends that cannot yet (Linux, Windows) would stop compiling.
Type-assert for it:
if s, ok := w.(glaze.Snapshotter); ok { png, err := s.Snapshot() }
type WebView ¶
type WebView interface {
// Run runs the main loop until it's terminated. After this function exits -
// you must destroy the webview.
Run()
// Terminate stops the main loop. It is safe to call this function from
// a background thread.
Terminate()
// Dispatch posts a function to be executed on the main thread. You normally
// do not need to call this function, unless you want to tweak the native
// window.
Dispatch(f func())
// Destroy destroys a webview and closes the native window.
Destroy()
// Window returns a native window handle pointer. When using GTK backend the
// pointer is GtkWindow pointer, when using Cocoa backend the pointer is
// NSWindow pointer, when using Win32 backend the pointer is HWND pointer.
Window() unsafe.Pointer
// SetTitle updates the title of the native window. Must be called from the UI
// thread.
SetTitle(title string)
// SetSize updates native window size. See Hint constants.
SetSize(w, h int, hint Hint)
// URI. Examples:
// w.Navigate("https://github.com/webview/webview")
// w.Navigate("data:text/html,%3Ch1%3EHello%3C%2Fh1%3E")
// w.Navigate("data:text/html;base64,PGgxPkhlbGxvPC9oMT4=")
Navigate(url string)
// GoBack, GoForward, Reload and Stop act on the page's history and load
// like the browser buttons of the same name; each is a no-op when there is
// nothing to do.
GoBack()
GoForward()
Reload()
Stop()
// Find selects and scrolls to the next match of text in the page, from
// the current selection, ignoring case and wrapping at the end; backwards
// searches up. done, when not nil, learns on the UI thread whether there
// was a match. Finding the same text again moves to the next match;
// empty text ends the search, clearing highlights where the engine draws
// them. A no-op on Windows (done gets false).
Find(text string, backwards bool, done func(found bool))
// SetZoom scales the page, text and images alike: 1 is 100%. The factor
// stays with the web view across navigations. A no-op on Windows.
SetZoom(factor float64)
// SetHtml sets the webview HTML directly.
// Example: w.SetHtml("<h1>Hello</h1>")
SetHtml(html string)
// Init injects JavaScript code at the initialization of the new page. Every
// time the webview will open a the new page - this initialization code will
// be executed. It is guaranteed that code is executed before window.onload.
Init(js string)
// Eval evaluates arbitrary JavaScript code. Evaluation happens asynchronously,
// also the result of the expression is ignored. Use RPC bindings if you want
// to receive notifications about the results of the evaluation.
Eval(js string)
// Focus moves keyboard focus into the web content, so typing - and a screen
// reader's cursor - lands inside the page without the user having to click it
// first. Each platform already does this when its window first appears and
// when the window is re-activated; Focus is the explicit, on-demand version
// for pulling focus back into the page. Call it from the UI thread.
Focus()
// Raise brings the window to the FRONT and gives the application focus, so
// it is clickable again without the user having to click twice. This is the
// case Focus does not cover: Focus moves the caret inside the page, Raise
// moves the window in front of everything else.
//
// The case it exists for: a program that took focus away from itself —
// launching a child window that activates, finishing a job that raised
// something else — and now needs its own window usable again. On macOS that
// matters more than it sounds, because a click on an inactive window is
// spent activating it (see Options.AcceptsFirstMouse), and for web content
// even that opt-in is not always enough.
//
// It is deliberately blunt, which is also why it should be used sparingly:
// stealing focus from someone typing in another application is worse than
// the second click it saves. Call it from the UI thread.
Raise()
// Bind binds a callback function so that it will appear under the given name
// as a global JavaScript function. Internally it uses webview_init().
// Callback receives a request string and a user-provided argument pointer.
// Request string is a JSON array of all the arguments passed to the
// JavaScript function.
//
// f must be a function
// f must return either value and error or just error
Bind(name string, f any) error
// Removes a callback that was previously set by Bind.
Unbind(name string) error
// OpenFile shows an "open file" dialog and returns the chosen path, or "" if
// the user cancelled.
OpenFile(opts FileDialogOptions) (string, error)
// OpenFiles shows an "open file" dialog that allows selecting multiple files
// and returns the chosen paths, or nil if the user cancelled.
OpenFiles(opts FileDialogOptions) ([]string, error)
// SaveFile shows a "save file" dialog and returns the chosen path, or "" if
// the user cancelled.
SaveFile(opts FileDialogOptions) (string, error)
// OpenDirectory shows a directory chooser and returns the chosen directory
// path, or "" if the user cancelled.
OpenDirectory(opts FileDialogOptions) (string, error)
}
WebView is the cross-platform handle returned by New and NewWindow. Its methods drive the native window and the embedded web view. Unless a method's own documentation says otherwise, call them from the UI thread (the goroutine that created the first window), and use Dispatch to re-enter that thread from background goroutines.
func NewWindow ¶
NewWindow creates a web view. If window is non-nil it must point to an existing GtkWindow to embed into; otherwise a new window is created.
The first successful call pins the calling goroutine to its OS thread.
func NewWithOptions ¶
NewWithOptions creates a web view configured by opts, including any custom SchemeHandlers (registered on the web view's context and marked as secure).
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package editor ships a small, dependency-free code editor for glaze WebViews: line numbers, syntax highlighting, autocompletion, error marks and bracket matching, in plain embedded HTML/CSS/JS — no CDN, no framework, nothing fetched at runtime, so a single-binary app stays a single binary.
|
Package editor ships a small, dependency-free code editor for glaze WebViews: line numbers, syntax highlighting, autocompletion, error marks and bracket matching, in plain embedded HTML/CSS/JS — no CDN, no framework, nothing fetched at runtime, so a single-binary app stays a single binary. |
|
Package menu builds native application menus without cgo.
|
Package menu builds native application menus without cgo. |







