Documentation
¶
Overview ¶
Package bridge embeds the renderer runtime that Golet injects into pages.
bridge.js is built from ../../packages/bridge by `bun run build` and committed, so building a Golet application never requires Bun.
Index ¶
Constants ¶
const LocaleEvent = "golet:locale"
LocaleEvent tells the pages of a window that the language the app shows changed, with a Locale. The bridge configuration tells pages the language at document start; the event is sent as a page loads too, for one that started loading as the language changed, and the bridge tells its listeners only of a language the page did not have.
const PreferencesEvent = "golet:preferences"
PreferencesEvent tells a page the accent color and the accessibility settings of the desktop, as golet.ThemePreferences encodes them. The bridge keeps the latest for golet-runtime's preferences(), the accent in the --golet-accent CSS variable and the text scale in --golet-text-scale.
const TitleBarEvent = "golet:title-bar"
TitleBarEvent tells a page of a window with a hidden title bar the room the window controls take. The bridge keeps it in the --golet-titlebar-* CSS variables.
Variables ¶
This section is empty.
Functions ¶
func PreferencesScript ¶
PreferencesScript delivers PreferencesEvent with the JSON prefs at document start, after the bridge has registered its handler.
Types ¶
type Config ¶
type Config struct {
Platform string `json:"platform"`
WindowID int `json:"windowId"`
Version string `json:"version"`
// Secret prefixes every message the bridge posts.
Secret string `json:"secret"`
// Locale is the language the app shows, e.g. "zh-Hans", and Dir the
// direction it is written in, "ltr" or "rtl", which pages read as
// golet.locale and golet.dir from document start.
Locale string `json:"locale"`
Dir string `json:"dir"`
}
Config is passed to the bridge as __GOLET_CONFIG__.