Optionalproperties: TurboModelProperties = {}Static ReadonlyALLSymbol used in nestAll, makeSignals, and generateObserver to target all entries at a certain level inside the data.
The default constructor used to create TurboObserver instances via generateObserver.
The default constructor used to create TurboObserver instances via generateObserver.
ReadonlyonProtectedisProtected ReadonlychangeProtected ReadonlynestedProtected ReadonlynestThe default constructor used to create nested TurboModel instances.
All values in the model, in the order of keys.
StaticfromProtectedsetupFunctionget
The key to read.
The stored value, or undefined if not found.
Functionget
Ordered path from outermost to innermost key.
The stored value, or undefined if not found.
FunctiongetFlat
A flat key produced by flattenKey.
Optionaldepth: numberRequired when flatKey is a numeric index. The depth of the key path.
The stored value, or undefined if not found.
FunctiongetKey
The value to locate.
The key path, or undefined if not found.
FunctiongetFlatKey
The value to query.
The flat key, or undefined if not found.
FunctiongetFlatKeys
The value to query.
Array of flat keys.
ProtectedinternalProtected FunctioninternalSet
The owning model (used for nested model lookup and change notification),
or undefined if operating on a non-root container.
The container to write to.
The value to set.
The key to write.
Write a value at a key, propagating the change to a nested model if one exists, and firing keyChanged if the value actually changed.
Functionset
The value to set.
The key to write.
Functionset
The value to set.
Ordered path from outermost to innermost key.
FunctionsetFlat
The value to set.
A flat key produced by flattenKey.
Optionaldepth: numberRequired when flatKey is a numeric index. The depth of the key path.
ProtectedinternalProtected FunctioninternalAdd
The owning model for change notification, or undefined for non-root containers.
The container to insert into.
The value to insert.
The target index or key.
The index or key where the value was stored.
Insert a value into a container via addAction and fire keyChanged.
Functionadd
The value to insert.
The index where the value was stored.
Push a value to the end of an array-backed model. For non-array models, forwards to set.
Functionadd
The value to insert.
Optionalkey: DataKeyTypeThe index to insert at. If omitted, the value is pushed to the end.
The index where the value was stored.
Insert a value into an array-backed model at the given index, or push it if no index is given. For non-array models, forwards to set.
Functionadd
The value to insert.
Key path to the target node, with the last key as the insertion index.
The index or key where the value was stored.
Insert a value at the given key path. For array-backed nodes, the last key is the insertion index. For non-array models, forwards to set.
FunctionaddFlat
The value to insert.
A flat key produced by flattenKey.
Optionaldepth: numberRequired when flatKey is a numeric index. The depth of the key path.
The index or key where the value was stored.
Functionhas
Ordered path from outermost to innermost key.
true if the entry exists.
FunctionhasFlat
A flat key produced by flattenKey.
Optionaldepth: numberRequired when flatKey is a numeric index. The depth of the key path.
ProtectedinternalProtected FunctioninternalDelete
The owning model for nested model cleanup and change notification,
or undefined for non-root containers.
The container to remove from.
The key to remove.
Remove a key from a container, clearing any associated nested model, and firing keyChanged. No-op if the key does not exist.
Functiondelete
Ordered path from outermost to innermost key.
FunctiondeleteFlat
A flat key produced by flattenKey.
Optionaldepth: numberRequired when flatKey is a numeric index. The depth of the key path.
FunctionforEach
Called with the value, key, and model.
OptionalthisArg: anyValue to use as this when calling the callback.
FunctionmakeSignals
The type of the signals' values.
Key path to the signal targets. Use ALL at any level to target all entries there.
Return reactive SignalBox instances for multiple keys at the given path. Pass TurboModel.ALL at any level of the path to expand all entries at that level.
FunctiongetSignal
The key whose signal to retrieve.
Retrieve an existing SignalBox for the given key, or undefined if none exists.
FunctiongetSignal
Key path, with the last key as the signal target.
Retrieve an existing SignalBox for the given key path, or undefined if none exists.
The last key in the path is the signal's target; preceding keys navigate to the parent nested model.
FunctionnestAll
Key path to the subtree to expand.
Array of nested models.
Create or retrieve nested TurboModel instances at each entry under the given key path. Use TurboModel.ALL in the path to expand all entries at that level.
FunctionnestAll
Key path followed by optional properties.
Array of nested models.
Create or retrieve nested TurboModel instances at each entry under the given key path, with custom initialization properties for the nested models. Use TurboModel.ALL in the path to expand all entries at that level.
Functionnest
The key of the nested model.
Create or retrieve a single nested TurboModel at the given key.
Functionnest
Ordered path from outermost to innermost key.
Create or retrieve a single nested TurboModel at the given key path.
Functionnest
Key path followed by optional properties.
Create or retrieve a single nested TurboModel at the given key path, with custom initialization properties.
FunctiongetNested
Ordered path from outermost to innermost key.
FunctiongenerateObserver
Optionalproperties: TurboObserverProperties<DataEntryType, ComponentType, DataKeyType> = {}Observer options and lifecycle callbacks.
Optional key path to the nested model(s) to observe. Use ALL at
any level to process all entries there.
Create and attach a TurboObserver to this model. If a key path is provided, the observer is attached to the nested model(s) at that path instead. Pass TurboModel.ALL at any level of the path to process all entries at that level, allowing a single observer to track multiple subtrees simultaneously.
ProtectedkeyProtected FunctionkeyChanged
The key path that changed.
Optionalvalue: unknown = ...The new value. Defaults to the current value at the key.
Optionaldeleted: boolean = falseWhether the entry was removed.
Called internally whenever an entry is added, updated, or deleted. Emits signals, fires onKeyChanged, and notifies attached observers.
FunctionscopeKey
The flat string key to convert.
Convert a flat string key back into a key path. Reverses the string form of flattenKey.
Segments starting with "@@" are decoded back to symbols.
FunctionscopeKey
The numeric index to convert.
The depth of the key path to reconstruct.
Convert a numeric global index back into a numeric key path. Reverses the numeric form of flattenKey.
ProtectedgetFunctiongetAction
The container to read from.
The key to read.
The value at the key, or undefined if not found.
ProtectedsetFunctionsetAction
The container to write to.
The value to set.
The key to write.
ProtectedaddFunctionaddAction
The owning model.
The container to insert into.
The value to insert.
The target index or key. Clamped to valid array bounds for array containers.
The index or key where the value was stored.
ProtectedhasFunctionhasAction
The container to check.
The key to check.
true if the key is present.
ProtecteddeleteFunctiondeleteAction
The container to remove from.
The key to remove.
Protectedobserve
Optional initialization properties.