Documentation
¶
Overview ¶
Package service ties long-lived Go values ("services") to the lifecycle of a tango.App: they start in registration order once the app is ready and shut down in reverse order when it terminates.
A service is any value. If it implements Starter, Startup runs on the main thread when the app is ready (or soon after Register, if it already is); if it implements Stopper, Shutdown runs on the main thread when the app terminates. Both block the main thread, so start long work on a goroutine and stop it with the context Startup receives, which is canceled before any Shutdown runs.
If a Startup fails, the services already started are shut down, the remaining ones are not started, and the app quits; Err reports why.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bind ¶
Bind registers svc's exported methods on router as "name.Method" (see package bind) and adds svc to app as Register does. Startup and Shutdown are lifecycle hooks, not API: calls to them from the page answer not_found.
func Err ¶
Err reports the Startup error that made app quit, if any, joined with the errors Shutdown methods returned.
Types ¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package fileserver serves a local directory over HTTP, for showing user files (downloads, generated images, a documents folder) in a page.
|
Package fileserver serves a local directory over HTTP, for showing user files (downloads, generated images, a documents folder) in a page. |
|
Package kv is a small thread-safe key-value store for app settings and state: kept in memory and, optionally, persisted to a JSON file.
|
Package kv is a small thread-safe key-value store for app settings and state: kept in memory and, optionally, persisted to a JSON file. |
|
Package log sets up application logging on log/slog: records go to stderr and to a log file that rotates by size, and the page can log through ipc (Handler).
|
Package log sets up application logging on log/slog: records go to stderr and to a log file that rotates by size, and the page can log through ipc (Handler). |
|
Package paths returns the per-user directories an application keeps its files in, on every platform Tango runs on.
|
Package paths returns the per-user directories an application keeps its files in, on every platform Tango runs on. |
|
Package updater keeps a Tango desktop app up to date: it fetches a signed update manifest, refuses anything older than what it runs (or has seen), downloads a binary patch or the full release, verifies it, installs it once the app quits, and rolls back if the new version does not confirm that it starts.
|
Package updater keeps a Tango desktop app up to date: it fetches a signed update manifest, refuses anything older than what it runs (or has seen), downloads a binary patch or the full release, verifies it, installs it once the app quits, and rolls back if the new version does not confirm that it starts. |
|
internal/e2e/drillapp
command
Command drillapp is the app of the macOS update drill (see ../drill_test.go): a headless Tango app whose version is set at link time.
|
Command drillapp is the app of the macOS update drill (see ../drill_test.go): a headless Tango app whose version is set at link time. |
|
updateui
Package updateui is a ready-made update window for apps that use service/updater: it checks for updates in the background, shows what a new release contains, downloads it with progress, and restarts into it when the user agrees.
|
Package updateui is a ready-made update window for apps that use service/updater: it checks for updates in the background, shows what a new release contains, downloads it with progress, and restarts into it when the user agrees. |