bridge

package
v0.1.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package bridge embeds the renderer runtime that MyGo injects into pages.

bridge.js is built from ../../packages/bridge by `bun run build` and committed, so building a MyGo application never requires Bun.

Index

Constants

View Source
const TitleBarEvent = "mygo: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 --mygo-titlebar-* CSS variables.

Variables

This section is empty.

Functions

func Script

func Script(cfg Config) string

Script returns the bridge source configured for one window.

func TitleBarScript added in v0.1.11

func TitleBarScript(tb platform.TitleBar, zoom float64) string

TitleBarScript delivers TitleBarEvent at document start, after the bridge, so that a page lays out around the window controls before it first paints.

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"`
}

Config is passed to the bridge as __MYGO_CONFIG__.

type TitleBar added in v0.1.11

type TitleBar struct {
	Height float64 `json:"height"`
	Left   float64 `json:"left"`
	Right  float64 `json:"right"`
}

TitleBar is the payload of TitleBarEvent, in CSS pixels.

func NewTitleBar added in v0.1.11

func NewTitleBar(tb platform.TitleBar, zoom float64) TitleBar

NewTitleBar converts the room of the window controls to the CSS pixels of a page shown at zoom.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL