forked from cujojs/rest
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathRestStore.js
More file actions
56 lines (46 loc) · 1.46 KB
/
Copy pathRestStore.js
File metadata and controls
56 lines (46 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
* Copyright 2012-2013 the original author or authors
* @license MIT, see LICENSE.txt for details
*
* @author Scott Andrews
*/
(function (define) {
'use strict';
define(function (require) {
var SimpleRestStore, queryResults;
SimpleRestStore = require('./SimpleRestStore');
queryResults = require('dojo/store/util/QueryResults');
/**
* A REST based object store.
*
* The base path for requests is commonly provided by the
*`rest/interceptor/pathPrefix` interceptor.
*
* Extends SimpleRestStore, but wraps the query results with Dojo's
* QueryResults.
*
* @param {RestStore} [options] configuration information that will be mixed
* into the store
*/
function RestStore(/* options */) {
SimpleRestStore.apply(this, arguments);
}
RestStore.prototype = Object.create(SimpleRestStore.prototype);
/**
* Queries the store for objects. This will trigger a GET request to the
* server, with the query added as a query string.
*
* @param {Object} query params used for the query string
* @param {Object} [options] reserved for future use
*
* @returns {QueryResult} query results
*/
RestStore.prototype.query = function query(/* query, options */) {
return queryResults(SimpleRestStore.prototype.query.apply(this, arguments));
};
return RestStore;
});
}(
typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); }
// Boilerplate for AMD and Node
));