Datasource

The datasource class encapsulates the access to data objects.

Import
the javascript logo
import { Datasource } from "@schukai/monster/source/data/datasource.mjs";
Source
the git logo
Package
the npm logo
Since
1.22.0

Exported

Datasource

Derived from

Base

Options

The Options listed in this section are defined directly within the class. This class is derived from several parent classes. Therefore, it inherits Options from these parent classes. If you cannot find a specific Options in this list, we recommend consulting the documentation of the Base.

Option
Type
Default
Description
-/-

Properties

The Properties listed in this section are defined directly within the class. This class is derived from several parent classes. Therefore, it inherits Properties from these parent classes. If you cannot find a specific Properties in this list, we recommend consulting the documentation of the Base.

Methods

The methods listed in this section are defined directly within the class. This class is derived from several parent classes. Therefore, it inherits methods from these parent classes. If you cannot find a specific method in this list, we recommend consulting the documentation of the Base.

Constructor

constructor()
creates a new datasource

Structural methods

get()
Returns
  • {Object|Array}
Returns real object
getOption(path,defaultValue)
Parameters
  • path {string}: path
  • defaultValue {*}: defaultValue
Returns
  • {*}
nested options can be specified by path a.b.c
set(data)
Parameters
  • data {object|array}: data
Returns
  • {Datasource}
setOption(path,value)
Parameters
  • path {string}: path
  • value {*}: value
Returns
  • {Datasource}
Set option
setOptions(options)
Parameters
  • options {string|object}: options
Returns
  • {Datasource}
Throws
  • {Error} the options does not contain a valid json definition

Static methods

[instanceSymbol]()2.1.0
Returns
  • {symbol}
This method is called by the instanceof operator.

Other methods

attachObserver(observer)
Parameters
  • observer {observer}: observer
Returns
  • {Datasource}
attach a new observer
containsObserver(observer)
Parameters
  • observer {observer}: observer
Returns
  • {boolean}
detachObserver(observer)
Parameters
  • observer {observer}: observer
Returns
  • {Datasource}
detach a observer
read()
Returns
  • {Promise}
Throws
  • {Error} this method must be implemented by derived classes.
write()
Returns
  • {Promise}
Throws
  • {Error} this method must be implemented by derived classes.

Events

This component does not fire any public events. It may fire events that are inherited from its parent classes.

The current width of the area is too small to display the content correctly.