Skip to main content

HttpDataSource

new HttpDataSource(jsonGraphUrl)

A HttpDataSource object is a DataSource can be used to retrieve data from a remote JSONGraph object using the browser's XMLHttpRequest.

Parameters:
Name Type Description
jsonGraphUrl

the URL of the JSONGraph model.

Source:
HttpDataSource.js, line 2
Example
var model = new falcor.Model({source: new falcor.HttpDataSource("http://netflix.com/user.json")});
var movieNames = model.get('genreLists[0...10][0...10].name').toPathValues();

Extends

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

Inherited From:
DataSource#call
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

Inherited From:
DataSource#get
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.

Inherited From:
DataSource#set
Source:
typedefs/DataSource.js, line 17
Returns:

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

Return Type:
Observable.<JSONGraphEnvelope>