PersistentModelObservable Module
API > [PersistentModelObservable Module]
Module
Interfaces
Functions
- enhancedObservable
- enhancedObservableArray
- isEnhancedObservable
- isEnhancedObservableArray
- makeNonEnumerable
- push
- toJS
- toJS_Primary
- toJS_Tracked
- toJS_nonPrimary
Functions
enhancedObservable
► enhancedObservable(data: any, delegate: IEnhancedObservableDelegate): any
Defined in PersistentModelObservable.ts:58
Factory to create a new MobX observable field that has the additional magic of @besync/GraphStore to notify when any observed field in the document is under active observation
Parameters:
| Param | Type | Description |
|---|---|---|
| data | any | The object of the given document to become observable |
| delegate | IEnhancedObservableDelegate | The document owner that will receive @besync/GraphStore observation notifications |
Returns: any
enhancedObservableArray
► enhancedObservableArray(delegate: IEnhancedObservableDelegate): IEnhancedObservableArrayany
Defined in PersistentModelObservable.ts:97
Factory to create a new MobX observable array that has the additional magic of @besync/GraphStore to notify when the collection is under active observation, and with loading, exists properties
Parameters:
| Param | Type | Description |
|---|---|---|
| delegate | IEnhancedObservableDelegate | The document owner that will receive @besync/GraphStore observation notifications |
Returns: IEnhancedObservableArrayany
isEnhancedObservable
► isEnhancedObservable(thing: any): boolean
Defined in PersistentModelObservable.ts:162
Helper method to determine if an object is a @besync/GraphStore Enhanced MobX observable document
Parameters:
| Param | Type | Description |
|---|---|---|
| thing | any | the object to test |
Returns: boolean
isEnhancedObservableArray
► isEnhancedObservableArray(thing: any): boolean
Defined in PersistentModelObservable.ts:153
Helper method to determine if an object is a @besync/GraphStore Enhanced MobX observable collection
Parameters:
| Param | Type | Description |
|---|---|---|
| thing | any | the object to test |
Returns: boolean
makeNonEnumerable
► makeNonEnumerable(obj: any, ...names: any[]): void
Defined in PersistentModelObservable.ts:263
Helper method used internally by @besync/GraphStore to hide all the private properties of a Model from enumeration, Object.keys(), .map(), etc.
Parameters:
| Param | Type | Description |
|---|---|---|
| obj | any | - |
| names | any[] | - |
Returns: void
push
► pushT(source: IEnhancedObservableArrayT): T
Defined in PersistentModelObservable.ts:245
Factory method to create a new document in a collection
Type parameters:
T
Parameters:
| Param | Type | Description |
|---|---|---|
| source | IEnhancedObservableArrayT | the collection |
Returns: T
toJS
► toJST(source: T, detectCycles?: boolean): T
► toJS(source: any, detectCycles?: boolean): any
► toJS(source: any, detectCycles: boolean, __alreadySeen: [any,any][]): any
Defined in PersistentModelObservable.ts:175
Recursively converts an (enhanced or non-enhanced observable) object to a javascript structure. Supports observable arrays, objects, maps and primitives. Computed values and other non-enumerable properties won't be part of the result. Cycles are detected and properly supported by default, but this can be disabled to improve performance.
Type parameters:
T
Parameters:
| Param | Type | Description |
|---|---|---|
| source | T | the MobX observable |
| detectCycles | boolean | default true |
Returns: T
Defined in PersistentModelObservable.ts:176
Parameters:
| Param | Type | Description |
|---|---|---|
| source | any | - |
| detectCycles | boolean | - |
Returns: any
Defined in PersistentModelObservable.ts:177
Parameters:
| Param | Type | Description |
|---|---|---|
| source | any | - |
| detectCycles | boolean | - |
| __alreadySeen | [any,any][] | - |
Returns: any
toJS_Primary
► toJS_Primary(source: any, primaryKeys: string[]): any
Defined in PersistentModelObservable.ts:231
Like toJS but only includes the Primary key fields in the resultant object
Parameters:
| Param | Type | Description |
|---|---|---|
| source | any | the MobX observable |
| primaryKeys | string[] | the list of primary keys to include |
Returns: any
toJS_Tracked
► toJS_Tracked(source: any): any
Defined in PersistentModelObservable.ts:216
Like toJS but only includes the @beysnc/GraphStore tracked fields in the resultant object
Parameters:
| Param | Type | Description |
|---|---|---|
| source | any | the MobX observable |
Returns: any
toJS_nonPrimary
► toJS_nonPrimary(source: any, primaryKeys: string[]): any
Defined in PersistentModelObservable.ts:202
Like toJS but only includes the non Primary key fields in the resultant object
Parameters:
| Param | Type | Description |
|---|---|---|
| source | any | the MobX observable |
| primaryKeys | string[] | the list of primary keys to exclude |
Returns: any