Description

Twigkit service for setting and getting responses.

Methods

clearResponses()

Removes all responses from the factory.

Example

  ResponseService.clearResponses();

createResponseFromResults(results)

Creates a response object from the set of results you provide
Parameters
ParamTypeDetails
resultsarrayThe list of results to add to this response.
Returns
ObjectReturns a newly created response object with the results provided.

Example

  ResponseService.createResponseFromResults(results);

getResponse(name, keys)

Gets response from the factory.
Parameters
ParamTypeDetails
namestringThe name of the response to retrieve
keys (optional)stringA comma separated list of keys you would like returned. If null whole response will be returned.
Returns
ObjectReturns the response object from the factory, if it doesn’t exist it will return null

Example

  ResponseService.getResponse(name);

setResponse(name, value)

Adds response to response factory for retrieval using the getResponse method. Broadcasts an event of ‘responsename_updated’ with the new response value.
Parameters
ParamTypeDetails
namestringThe name of the response
valueObjectThe response object to add to the factory.

Example

  ResponseService.setResponse(name, value);