Documentation
¶
Overview ¶
Package host is the hot-reload host process: it owns the canvas windows of an app run by `tan dev` and shows frames rendered by worker processes (each rebuild of the app), forwarding input to the current worker and swapping workers without closing windows. See docs/specs/ui-hotreload.md and package devhost for the protocol.
The host is the app binary itself started with TANGO_DEV_ROLE=host: package uihost calls Main from its init, on the main thread, and exits without running the app's main. It only runs framework code.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ResizeWait is how long CanvasFrame waits for a frame of the new // size after a resize, so live resize shows fresh content. ResizeWait = 50 * time.Millisecond // RequestTimeout re-sends a FrameRequest a worker did not answer. RequestTimeout = time.Second // SnapshotTimeout bounds waiting for the old worker's state. SnapshotTimeout = 2 * time.Second // OrphanGrace keeps windows of a replaced worker that the new worker // did not reopen (yet) before closing them. OrphanGrace = 2 * time.Second // NoWindowCommit swaps to a new worker that opened no window at all // after this long. NoWindowCommit = 5 * time.Second // FreezeLimit bounds how long input is held back from the old worker // for a new one that does not show a frame. FreezeLimit = 10 * time.Second // ReclaimWindow is how long after a swap the host takes activation // back from the new worker (see Host.lifecycle). ReclaimWindow = 2 * time.Second )
Tunables (variables for tests).
var NewA11yBridge func(cv platform.Canvas) A11yBridge
NewA11yBridge creates the bridge of a host window's canvas; nil (or a nil result: the canvas cannot expose a tree) leaves the windows without one. Package uihost sets it.
Functions ¶
Types ¶
type A11yBridge ¶
type A11yBridge interface {
// Active reports whether an assistive technology uses the canvas. It
// is polled at the start of every CanvasFrame and may itself update
// the platform (drop its tree when the technology left).
Active() bool
// Update hands the platform a new tree; changed as for
// ui.AccessibilityHost.
Update(tree *a11y.Tree, changed []a11y.NodeID)
// Replace gives the platform tree instead of the one it has (another
// process drew it), dropping the old one with its focus first.
Replace(tree *a11y.Tree)
// Reset drops the platform's tree (no tree to show).
Reset()
// Close releases the bridge (the window closed).
Close()
}
A11yBridge is the platform accessibility bridge of one host window's canvas. All methods run on the main thread.
type Host ¶
type Host struct {
// Token, when set before Serve, is the session token every peer must
// send in Hello (devhost.EnvToken); others are refused.
Token string
// contains filtered or unexported fields
}
Host is the hot-reload host. Its state is owned by the app's main thread unless noted.