Monster.Data. Datasource

Namespace for datasources

Author
  • schukai GmbH

Classes

RestAPI

The LocalStorage class encapsulates the access to data objects.

Storage

The Storage class encapsulates the access to data objects over WebStorageAPI.

Namespaces

RestAPI

Namespace for storages

.
Storage

Namespace for storages

.

Members

defaults

Derived classes can override and extend this method as follows.

Derived classes can override and extend this method as follows.

get defaults() {
   return Object.assign({}, super.defaults, {
       myValue:true
   });
}

Methods

attachObserver(observer) → {Datasource}

attach a new observer

.

attach a new observer

Parameters:
NameTypeDescription
observerObserver
Returns:
Type: 
Datasource

containsObserver(observer) → {boolean}

Parameters:
NameTypeDescription
observerObserver
Returns:
Type: 
boolean

detachObserver(observer) → {Datasource}

detach a observer

.

detach a observer

Parameters:
NameTypeDescription
observerObserver
Returns:
Type: 
Datasource

get() → {Object|Array}

Returns real object

.

Returns real object

Returns:
Type: 
Object | Array

getOption(path, defaultValue) → {*}

nested options can be specified by path a.b.c

.

nested options can be specified by path a.b.c

Parameters:
NameTypeDescription
pathstring
defaultValue*
Returns:
Type: 
*

read() → {Promise}

Throws:

this method must be implemented by derived classes.

Type
Error
Returns:
Type: 
Promise

set(data) → {Datasource}

Parameters:
NameTypeDescription
dataObject | Array
Returns:
Type: 
Datasource

setOption(path, value) → {Datasource}

Set option

.

Set option

Parameters:
NameTypeDescription
pathstring
value*
Returns:
Type: 
Datasource

setOptions(options) → {Datasource}

Parameters:
NameTypeDescription
optionsstring | object
Throws:

the options does not contain a valid json definition

Type
Error
Returns:
Type: 
Datasource

write() → {Promise}

Throws:

this method must be implemented by derived classes.

Type
Error
Returns:
Type: 
Promise

Type Definitions

exampleCallback(value, key)

This callback can be passed to a datasource and is used to adapt data structures.

This callback can be passed to a datasource and is used to adapt data structures.

Parameters:
NameTypeDescription
value*

Value

keystring

Key