Core lifecycle
Contract
v0.1.7 adds the first Go WebAssembly frontend runtime for GX. It mounts a
root Go function component into a browser element, renders its gx.Node tree,
wires callback props to browser events, and rerenders after Go state changes.
The runtime stays small. It does not define effects, resources, polling, streaming, close guards, logging transports, or host configuration files. Application code owns state, side effects, API calls, and logging in ordinary Go.
The runtime owns only:
- locating one mount element;
- calling the root Go function component;
- rendering the returned node tree into the DOM;
- retaining JavaScript callback wrappers for function props;
- rerendering when application code requests an update;
- releasing retained callback wrappers on unmount.
The root component is an ordinary Go function:
func App() gx.Node
Mounting uses a small Go API:
app, err := gxwasm.Mount("#app", App)
if err != nil {
return err
}
defer app.Unmount()
The host page must contain an element matching the selector before Mount
runs, for example <div id="app"></div>. If the selector matches no element,
Mount returns an error and does not retain callbacks or mounted state.
Unmount is idempotent. After unmount, callback wrappers created by that mount
must no longer call application code.
Consequence
Product modules can build browser UI mostly in Go. Core owns only predictable mount, callback, update, and unmount behavior.