TinyBase logoTinyBase β

PersisterListener

A PersisterListener is a generic representation of the callback that lets a Persister inform the store that a change has happened to the underlying data.

(
  content?: PersistedContent<Persist>,
  changes?: PersistedChanges<Persist>,
): void
TypeDescription
content?PersistedContent<Persist>

If provided, this is a Content object from the the Persister that will be used to immediately wholesale update the Store.

changes?PersistedChanges<Persist>

If provided, this is a Changes object from the the Persister that will be used to immediately incrementally update the Store. This takes priority over the content argument above if present.

returnsvoid

This has no return value.

Using the values of the Persists enum, the generic parameter indicates whether the Persister is handling content and changes from a regular Store, a MergeableStore, or either.

If the listener is called with the changes parameter, it will be used to make an incremental change to the Store. If not, but the content parameter is available, that will be used to make a wholesale change to the Store. If neither are present, the content will be loaded using the Persister's load method. Prior to v5.0, these parameters were callbacks and the overall type was non-generic.

Since

v4.0.0