-
Notifications
You must be signed in to change notification settings - Fork 83
/
RequestMemory.js
40 lines (34 loc) · 996 Bytes
/
RequestMemory.js
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
define([
'dojo/_base/declare',
'./Request',
'./Cache'
], function (declare, Request, Cache) {
// module:
// dstore/RequestMemory
return declare([ Request, Cache ], {
// summary:
// A store which makes one request to a server for all of its data, then performs all
// operations client-side. Technically a composition of the Request and Cache stores.
isValidFetchCache: true,
postscript: function () {
this.inherited(arguments);
this.fetch();
},
refresh: function (target) {
// summary:
// Refreshes the store data from the current target or a new target.
// target: String?
// Optional; new target to retrieve data from. Uses the existing target by default.
if (this.fetchRequest) {
// Clear any currently-pending fetch request, since we're about to request again
this.fetchRequest.cancel();
this.fetchRequest = null;
}
if (target) {
this.target = target;
}
this.invalidate();
return this.fetch();
}
});
});