@tempots/dom 31.3.0 → 31.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -121,6 +121,28 @@ const list = html.ul(
|
|
|
121
121
|
)
|
|
122
122
|
```
|
|
123
123
|
|
|
124
|
+
### Storage-Backed Props
|
|
125
|
+
|
|
126
|
+
Tempo provides helpers that persist reactive state to Web Storage through `storedProp`,
|
|
127
|
+
`localStorageProp`, and `sessionStorageProp`.
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
const theme = localStorageProp({
|
|
131
|
+
key: 'tempo:theme',
|
|
132
|
+
defaultValue: 'light',
|
|
133
|
+
syncTabs: true, // the default
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
theme.value = 'dark' // automatically persisted and broadcast to other tabs
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
When `syncTabs` is enabled (the default), Tempo uses the Broadcast Channel API to
|
|
140
|
+
propagate updates across browser contexts that share the same origin. If the API is not
|
|
141
|
+
available, or if you prefer to isolate storage changes per tab, set `syncTabs: false`.
|
|
142
|
+
|
|
143
|
+
All values pass through the provided `serialize`/`deserialize` functions before being
|
|
144
|
+
stored, so cross-tab updates respect custom serialization logic as well.
|
|
145
|
+
|
|
124
146
|
## Documentation
|
|
125
147
|
|
|
126
148
|
For comprehensive documentation, visit the [Tempo Documentation Site](https://tempo-ts.com/).
|