Force immediate synchronization to IndexedDB. By default, storage operations are queued and written asynchronously. Call `sync()` when you need to guarantee changes are persisted immediately, such as before critical operations or page unload. ```python
(self)
| 183 | super().clear() |
| 184 | |
| 185 | async def sync(self): |
| 186 | """ |
| 187 | Force immediate synchronization to IndexedDB. |
| 188 | |
| 189 | By default, storage operations are queued and written asynchronously. |
| 190 | Call `sync()` when you need to guarantee changes are persisted immediately, |
| 191 | such as before critical operations or page unload. |
| 192 | |
| 193 | ```python |
| 194 | store = await storage("important-data") |
| 195 | store["critical_value"] = data |
| 196 | |
| 197 | # Ensure it's written before proceeding. |
| 198 | await store.sync() |
| 199 | ``` |
| 200 | |
| 201 | This is a blocking operation that waits for IndexedDB to complete |
| 202 | the write. |
| 203 | """ |
| 204 | await self._store.sync() |
| 205 | |
| 206 | |
| 207 | async def storage(name="", storage_class=Storage): |
no outgoing calls