capdemo

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package capdemo is the M2 capability-broker showcase app. One window, four sections: a fs.dialog.read round-trip (pick a file, get a handle, fetch contents), a runtime.persist.{ownAlias}.scratchpad round-trip (save / load / delete a TextEdit's contents), an fs.dialog.watch round-trip (pick a folder, stream change events on fs.handle.{uuid}.event), and a status pane showing what's pending. Demonstrates that an app declaring the right Caps gets working Bus() and Storage() through MountContextI without any direct syscalls.

Lifecycle: Mount captures the BusI and StorageI from the context. The file dialog flow runs in a goroutine because bus.Request blocks until the picker resolves; results land in fields guarded by `mu` and rendered on the next Frame.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	// contains filtered or unexported fields
}

App is the per-window capdemo instance. Mount captures bus + storage from the MountContextI; Frame renders the three sections; Unmount is a no-op (the goroutine guards against use-after-unmount by checking app state before mutating).

func (*App) Frame

func (inst *App) Frame(ctx app.FrameContextI) (err error)

Frame renders the demo sections. The host has already pre-pushed a window-unique salt onto inst.ids via c.IdScope (windowhost. renderWindowBody, ADR-0026 §SD9), so widget ids derived from inst.ids are unique across all concurrently open instances — the app must not Reset() the stack or wrap the body in its own instance salt (doing so discards the host salt and collides with sibling apps that share a label string).

func (*App) Manifest

func (inst *App) Manifest() (m app.Manifest)

func (*App) Mount

func (inst *App) Mount(ctx app.MountContextI) (err error)

Mount captures the per-app BusI and StorageI handles. The values are dormant on M1 hosts (NoopBus / NoopStorage) — every call errors with a documented "not available" message; on M2 hosts (carousel Phase A+B+C wiring) they are real inprocbus.Client / persist.Client. Either way, Mount itself is infallible.

func (*App) Unmount

func (inst *App) Unmount(ctx app.MountContextI) (err error)

Jump to

Keyboard shortcuts

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