Cheat Sheet¶
Basics¶
| Item | Overview |
|---|---|
| Instance |
Create an instance: Choose a different location: |
| Stores |
Create a store: Default value: Manage stores: |
| Read and write |
|
| Types and validation |
Flexible types: Validated both ways: |
| Copies (non-reactive types) |
Reading a non-reactive value returns a copy: Values are copied on insert as well: |
Reactivity¶
| Item | Overview |
|---|---|
| Reactive types |
|
| Reactive stores |
Use a reactive type for the store: Mutate it in place: |
| Reactive chain |
Reactive types compose: Plain data becomes reactive on the way in, at any depth: Non-reactive values inside a reactive one are copied, like at the store level: |
| Lifecycle |
Created by hand, an object is inert and acts like its plain counterpart: Read from a store, it's live: Removed from the store, it's dead (and so is everything inside it): Check the state: |
| Unions |
A change of type kills the old object: |
Collections¶
| Item | Overview |
|---|---|
SyncDict |
Keys must round-trip through a JSON string: |
SyncList |
References follow positions, not content: |
SyncSet |
Items must be hashable, so reactive items aren't allowed: |
Models¶
| Item | Overview |
|---|---|
SyncModel |
Subclass Pass a |
store decorator |
Define a model and create its store in one step: By default (
Or pick the collection yourself: |
SyncRoot |
A reactive single value: |
sync_dataclass |
|
| Restrictions |
|