Namespace for datasources
Classes
- RestAPI
The LocalStorage class encapsulates the access to data objects.
- Storage
The Storage class encapsulates the access to data objects over WebStorageAPI.
Namespaces
Members
# defaults
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
Parameters:
Name | Type | Description |
---|---|---|
observer |
Observer |
Returns:
- Type
- Datasource
# containsObserver(observer) → {boolean}
Parameters:
Name | Type | Description |
---|---|---|
observer |
Observer |
Returns:
- Type
- boolean
# detachObserver(observer) → {Datasource}
detach a observer
Parameters:
Name | Type | Description |
---|---|---|
observer |
Observer |
Returns:
- Type
- Datasource
# get() → {Object|Array}
Returns real object
Returns:
- Type
- Object | Array
# getOption(path, defaultValue) → {*}
nested options can be specified by path a.b.c
Parameters:
Name | Type | Description |
---|---|---|
path |
string | |
defaultValue |
* |
Returns:
- Type
- *
# read() → {Promise}
Throws:
-
this method must be implemented by derived classes.
- Type
- Error
Returns:
- Type
- Promise
# set(data) → {Datasource}
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | Array |
Returns:
- Type
- Datasource
# setOption(path, value) → {Datasource}
Set option
Parameters:
Name | Type | Description |
---|---|---|
path |
string | |
value |
* |
Returns:
- Type
- Datasource
# setOptions(options) → {Datasource}
Parameters:
Name | Type | Description |
---|---|---|
options |
string | 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.
Parameters:
Name | Type | Description |
---|---|---|
value |
* | Value |
key |
string | Key |