windowstate

package
v0.1.0-rc.14 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package windowstate keeps crash recovery records while a window owns its lease.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Write

func Write[T any](name string, value *T) error

Write atomically replaces a private state file, flushing before the rename so an interrupted write leaves the last complete snapshot available.

Types

type Window

type Window[T any] struct {
	Value T

	Restored bool
	// contains filtered or unexported fields
}

func Open

func Open[T any](directory, id string, restore bool) (*Window[T], []string, error)

Open 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.

func (*Window[T]) Forget

func (w *Window[T]) Forget() error

Forget is called only after the user's close request has been approved.

func (*Window[T]) Release

func (w *Window[T]) Release()

Release leaves the recovery record intact on errors and process shutdown.

func (*Window[T]) Save

func (w *Window[T]) Save(value *T) error

Jump to

Keyboard shortcuts

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