Skip to content

ViewModelStoreBase class ​

This is the base implementation of the ViewModelStore interface.

Reference to source code

Methods and properties ​

Here is documentation about base implementation methods and properties.
If you need to read about ViewModelStore interface methods and properties, go here.

viewModels (protected) ​

Map structure with created ViewModel instances in application (id → instance).

viewModelIdsByClasses (protected) ​

Map from ViewModel class to the list of registered instance ids.

linkedAnchorVMClasses (protected) ​

Map from component anchors to their ViewModel classes, used for lookups by component.

vmConfig ​

Effective ViewModelsConfig, merged from global defaults and store options.

resource ​

Store-scoped data source for view models. Defaults to the resource in vmConfig when no store resource is supplied. See the interface documentation.

connect(instance, config) ​

Registers an already created instance in the store: links anchors, indexes the instance by ID and class, and calls init(...) when present. It does not call mount().

define(config) ​

See interface. Generates an ID and returns an existing instance with that ID, or creates one via create and registers it via connect.

create(config) ​

See interface. Uses config.factory or vmConfig.factory.

unmount(instance) ​

See interface.

clean() ​

Clears the store's instance, class, and anchor indexes. It does not call unmount() on the instances.

attachVMConstructor(model) / dettachVMConstructor(model) (protected) ​

Maintain viewModelIdsByClasses so lookups by class work after connect / unmount.