Skip to main content

DataSource

(abstract) new DataSource()

A DataSource is an interface which can be implemented to expose JSON Graph information to a Model. Every DataSource is associated with a single JSON Graph object. Models execute JSON Graph operations (get, set, and call) to retrieve values from the DataSource’s JSON Graph object. DataSources may retrieve JSON Graph information from anywhere, including device memory, a remote machine, or even a lazily-run computation.

Source:
typedefs/DataSource.js, line 1

Methods

call(functionPath, args, refSuffixes, thisPaths) → {Observable.<JSONGraphEnvelope>}

Invokes a function in the DataSource's JSONGraph object.

Parameters:
Name Type Description
functionPath Path

the path to the function to invoke

args Array.<Object>

the arguments to pass to the function

refSuffixes Array.<PathSet>

paths to retrieve from the targets of JSONGraph References in the function's response.

thisPaths Array.<PathSet>

paths to retrieve from function's this object after successful function execution

Source:
typedefs/DataSource.js, line 26
Returns:

jsonGraphEnvelope the response returned from the server.

Return Type:
Observable.<JSONGraphEnvelope>

get(pathSets) → {Observable.<JSONGraphEnvelope>}

The get method retrieves values from the DataSource's associated JSONGraph object.

Parameters:
Name Type Description
pathSets Array.<PathSet>

the path(s) to retrieve

Source:
typedefs/DataSource.js, line 8
Returns:

jsonGraphEnvelope the response returned from the server.

Return Type:
Observable.<JSONGraphEnvelope>

set(jsonGraphEnvelope) → {Observable.<JSONGraphEnvelope>}

The set method accepts values to set in the DataSource's associated JSONGraph object.

Parameters:
Name Type Description
jsonGraphEnvelope JSONGraphEnvelope

a JSONGraphEnvelope containing values to set in the DataSource's associated JSONGraph object.

Source:
typedefs/DataSource.js, line 17
Returns:

a JSONGraphEnvelope containing all of the requested values after the set operation.

Return Type:
Observable.<JSONGraphEnvelope>