Skip to main content

Arlecchino.Atoms

Classes

TypeSummary
ArlecchinoAsyncStoreA store that has to fetch something before it holds the truth. Override ArlecchinoAsyncStore.LoadAsync, and the load is started as the application starts and its bookkeeping kept. csharp public sealed class SettingsStore : ArlecchinoAsyncStore { public TrackedAtom<string> Server { get; } = new("127.0.0.1"); protected override async Task LoadAsync(CancellationToken token) { await using var fs = new FileStream(SettingsPath, FileMode.Open, FileAccess.Read); var saved = await JsonSerializer.DeserializeAsync<Saved>(fs, cancellationToken: token); Server.Post(saved.Server); } }
AsyncAtom<T>A value produced by background work, with its progress exposed as state for a view to draw. Results are handed back on the drawing thread, and a new load cancels the one before it.
AtomHistoryUndo and redo over every TrackedAtom, collecting from the moment it exists. The stack is bounded, and steps past AtomHistory.Capacity fall off the far end.
Atom<T>One piece of application state that notifies what reads it and marks the frame stale by itself. Whether an edit can be undone is decided by creating a TrackedAtom or a LocalAtom.
Computed<T>A value derived from other atoms. It re-evaluates lazily and tracks whatever it read while doing so, including other computed values and branches taken only sometimes — reading other.Value inside the lambda is the subscription.

Interfaces

TypeSummary
IArlecchinoScopedStoreA store that lives as long as the screen that asked for it: navigating away disposes the scope and with it the store, and navigating back builds a fresh one. Registered by AddGeneratedStores() exactly as an IArlecchinoStore is, only scoped.
IArlecchinoStoreA holder of application state: a class of atoms that outlive the screens reading them. Marking it is all the registration there is, and IArlecchinoScopedStore is the one for a single screen.
IAtomEditOne recorded change of one atom, as kept by AtomHistory. Replaying it does not record a new step.
IReadableAtom<T>Something that holds a value and tells interested parties when it changes. Implemented by Atom and Computed.

Enums

TypeSummary
LoadStatusWhere a background load has got to.