persist
functionsignature
persist(store, options): () => Promise<void>Writes state as it changes.
Parameters
| Name | Type | Description |
|---|---|---|
store | PersistableStore |
| Name | Type | Description |
|---|---|---|
options | PersistOptions |
Returns
() => Promise<void>, A function that stops persisting, flushes anything pending, and returns a promise
that resolves once the last write has settled. Await it before tearing the store down: with
an asynchronous adapter the final write is otherwise still in flight. It never rejects; a
failed write is reported through onError.