The type of data handled by the observer.
The instance type created/managed by the observer.
The per-item key type.
The block-grouping key type.
The type of data handled by the observer.
The instance type created/managed by the observer.
The per-item key type.
The block-grouping key type.
Optionalproperties: TurboObserverProperties<DataType, ComponentType, KeyType, BlockKeyType> = {}Initialization options and lifecycle callbacks.
Create a TurboObserver.
By default, the observer wires onUpdated to update instance data if the instance
exposes a TurboModel, or data / dataId fields. It also wires onDeleted and removes the instance
when the associated key is deleted.
Protected_ReadonlyonReadonlyonReadonlyonReadonlyonReadonlyonProtected ReadonlynestedWhether the observer has been initialized (i.e. initialize called).
ProtecteddefaultProtectedFunctionremoveKey
The key to remove.
OptionalblockKey: BlockKeyType = ...Block grouping key.
OptionalremoveFromDOM: boolean = trueWhether to call instance.remove() when available.
Functionremove
The instance to remove.
OptionalremoveFromDOM: boolean = trueWhether to call instance.remove() when available.
FunctionkeyChanged
The changed item key.
The new value for the item.
Optionaldeleted: boolean = falseWhether the item was removed.
OptionalblockKey: BlockKeyType = ...Block grouping key.
Functionget
Item key.
OptionalblockKey: BlockKeyType = ...Block grouping key.
undefined.Functionset
The value to set.
The key to set.
OptionalblockKey: BlockKeyType = ...Block grouping key.
FunctiongetKey
The value to locate.
undefined if not found.FunctiongetKeys
The value to locate.
FunctiongetFlatKey
The value to query.
FunctiongetFromFlatKey
Global index or flattened string key (produced by flattenKey).
FunctiongetEntriesForBlock
OptionalblockKey: BlockKeyType = ...Block grouping key.
FunctiongetKeysForBlock
OptionalblockKey: BlockKeyType = ...Block grouping key.
FunctiongetValuesForBlock
OptionalblockKey: BlockKeyType = ...Block grouping key.
FunctionhasKey
The targeted key.
OptionalblockKey: BlockKeyType = ...Block grouping key.
Whether a value exists.
FunctionhasBlock
OptionalblockKey: BlockKeyTypeBlock grouping key.
Whether a block exists.
FunctiongetBlockSize
OptionalblockKey: BlockKeyType = ...Block grouping key.
The size of the block.
FunctionflattenKey
Item key.
OptionalblockKey: BlockKeyType = ...Block grouping key.
FunctionscopeKey
Flattened key or global index.
Reverse flattenKey: if given a string in the form "blockKey|key", it returns {blockKey, key}`.
Protectedget
TurboObserver
Description
Generic observer that keeps a set of component instances organized by block key and item key. Useful to maintain UI components or other per-entry objects synchronized with a data source (e.g. a TurboDataBlock or a TurboModel).