Submodel
API > [PersistentModel Module] > Submodel
Class
A submodel represents an observable JSON object structure contained for a given field of a model
It behaves just like a root Model, with all the @besync/GraphStore and MobX magic
Hierarchy
↳ Submodel
Implements
Constructors
Properties
Methods
Constructors
any
): Submodel
⊕ new Submodel(defaults: Overrides Model.constructor
Defined in PersistentModel.ts:319
Parameters:
Param | Type | Description |
---|---|---|
defaults | any | - |
Returns: Submodel
Properties
_isDirty
● _isDirty: boolean
Defined in PersistentModel.ts:32
exists
● exists: boolean
= true
Defined in PersistentModel.ts:27
loading
● loading: boolean
= false
Defined in PersistentModel.ts:26
status
● status: Status
Defined in PersistentModel.ts:28
Methods
addObserver
► addObserver(): void
Implementation of IEnhancedObservableDelegate.addObserver
Inherited from Model.addObserver
Defined in PersistentModel.ts:106
IEnhancedObservableDelegate.addObserver
Used internally by @besync/GraphStore to indicate when the first new observer is watching this collection
Returns: void
delete
► delete(): void
Defined in PersistentModel.ts:96
Deletes this document from the store
Returns: void
keys
► keys(): string
[]
Defined in PersistentModel.ts:173
Get the keys of this model, including both owned properties and those managed by @besync/GraphStore
Returns: string
[]
List of keys as a string array
releaseObserver
► releaseObserver(): void
Implementation of IEnhancedObservableDelegate.releaseObserver
Inherited from Model.releaseObserver
Defined in PersistentModel.ts:117
IEnhancedObservableDelegate.addObserver
Used internally by @besync/GraphStore to indicate when no more observers are watching this collection
Returns: void
toString
► toString(): string
Defined in PersistentModel.ts:183
Gets a string representation of this model in JSON format, useful for debugging purposes
Returns: string
string representation of this model in JSON format
«Static» getCollection
► getCollection(keys: any
, path: string
): any
[]
Inherited from Model.getCollection
Defined in PersistentModel.ts:224
Class method to get an observable collection of documents from the default persistent store param:: path A string representing the database access path to the location of the collection
Parameters:
Param | Type | Description |
---|---|---|
keys | any | A key:value dictionary representing the subset of primary keys to query on |
path | string | - |
Returns: any
[]
An instance of this model that can be observed over time to represent the selected document
«Static» getDocument
► getDocument(keys: any
, path: string
): any
Inherited from Model.getDocument
Defined in PersistentModel.ts:203
Class method to get an observable document from the default persistent store param:: path A string representing the database access path to the location of the document
Parameters:
Param | Type | Description |
---|---|---|
keys | any | A key:value dictionary representing the primary keys to query on |
path | string | - |
Returns: any
An instance of this model that can be observed over time to represent the selected document
«Static» setDefaultStore
► setDefaultStore(graphStore: IGraphStore): void
Inherited from Model.setDefaultStore
Defined in PersistentModel.ts:192
Class method to set the default persistent store for all instances of this model type
Parameters:
Param | Type | Description |
---|---|---|
graphStore | IGraphStore | the default persistent store |
Returns: void