{"modulePath":"github.com/pencode-labs/pencode","version":"v0.1.0-rc.15","isLatest":true,"isStandardLibrary":false,"goos":"linux","goarch":"amd64","docs":"# package windowstate\n\nPackage windowstate keeps crash recovery records while a window owns its lease.\n\n## Functions\n\n```go\nfunc Write[T any](name string, value *T) error\n```\nWrite atomically replaces a private state file, flushing before the rename so an interrupted write leaves the last complete snapshot available.\n\n## Types\n\n```go\ntype LaunchInbox[T any] struct {\n\t// contains filtered or unexported fields\n}\n```\nLaunchInbox forwards desktop launches to the process that owns the windows. Atomic files retain requests across startup and native event coalescing.\n\n```go\nfunc ForwardLaunch[T any](dir string, request T, wake func()) (*LaunchInbox[T], error)\n```\nForwardLaunch returns nil after handing the request to a running instance.\n\n```go\nfunc (q *LaunchInbox[T]) Close()\n```\n\n```go\nfunc (q *LaunchInbox[T]) Drain(lastWindowClosed bool, receive func(T)) error\n```\nDrain releases the lease under the dispatch lock when the last window closes and no launch is waiting. A concurrent launch can then become the next owner.\n\n```go\ntype Window[T any] struct {\n\tValue T\n\n\tRestored bool\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc Open[T any](directory, id string, restore bool) (*Window[T], []string, error)\n```\nOpen restores all windows on a cold application launch. A live lease means the application is already running; another launch then opens a fresh window. Explicit restore IDs identify additional windows of a cold launch.\n\n```go\nfunc (w *Window[T]) Forget() error\n```\nForget is called only after the user's close request has been approved.\n\n```go\nfunc (w *Window[T]) Release()\n```\nRelease leaves the recovery record intact on errors and process shutdown.\n\n```go\nfunc (w *Window[T]) Save(value *T) error\n```\n\n","path":"github.com/pencode-labs/pencode/internal/windowstate","name":"windowstate","synopsis":"Package windowstate keeps crash recovery records while a window owns its lease.","isRedistributable":true}
