Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ModelDB

A concrete implementation of an IModelDB. A namespace for the ModelDB class statics.

Hierarchy

  • ModelDB

Implements

Index

Constructors

constructor

Properties

Private _basePath

_basePath: string

Private _db

Private _disposables

_disposables: DisposableSet = new DisposableSet()

Private _isDisposed

_isDisposed: boolean = false

Private _toDispose

_toDispose: boolean = false

connected

connected: Promise<void> = Promise.resolve(void 0)

A promise resolved when the model is connected to its backend. For the in-memory ModelDB it is immediately resolved.

isCollaborative

isCollaborative: boolean = false

Whether the model is collaborative.

isPrepopulated

isPrepopulated: boolean = false

Whether the model has been populated with any model values.

Accessors

basePath

  • get basePath(): string
  • The base path for the ModelDB. This is prepended to all the paths that are passed in to the member functions of the object.

    Returns string

isDisposed

  • get isDisposed(): boolean
  • Whether the database is disposed.

    Returns boolean

Methods

Private _resolvePath

  • _resolvePath(path: string): string
  • Compute the fully resolved path for a path argument.

    Parameters

    • path: string

    Returns string

createList

  • Create an undoable list and insert it in the database.

    Type parameters

    • T: JSONValue

    Parameters

    • path: string

    Returns IObservableUndoableList<T>

    the list that was created.

    Notes

    The list can only store objects that are simple JSON Objects and primitives.

createMap

  • Create a map and insert it in the database.

    Parameters

    • path: string

    Returns IObservableJSON

    the map that was created.

    Notes

    The map can only store objects that are simple JSON Objects and primitives.

createString

createValue

dispose

  • dispose(): void

get

getValue

  • getValue(path: string): JSONValue | undefined
  • Get a value at a path, or undefined if it has not been set That value must already have been created usingcreateValue`.

    Parameters

    • path: string

    Returns JSONValue | undefined

has

  • has(path: string): boolean
  • Whether the IModelDB has an object at this path.

    Parameters

    • path: string

    Returns boolean

    a boolean for whether an object is at path.

set

  • Set a value at a path. Not intended to be called by user code, instead use the create* factory methods.

    Parameters

    Returns void

setValue

  • setValue(path: string, value: JSONValue): void
  • Set a value at a path. That value must already have been created using createValue.

    Parameters

    • path: string
    • value: JSONValue

    Returns void

view

  • Create a view onto a subtree of the model database.

    Parameters

    • basePath: string

    Returns ModelDB

    an IModelDB with a view onto the original IModelDB, with basePath prepended to all paths.

Generated using TypeDoc