@@ -20,7 +20,7 @@ define([
20
20
method : 'GET' ,
21
21
dataType : 'json'
22
22
} ,
23
- dataNamespace : '' ,
23
+ dataScope : '' ,
24
24
data : { }
25
25
} ,
26
26
@@ -30,14 +30,14 @@ define([
30
30
* @returns {DataStorage } Chainable.
31
31
*/
32
32
initConfig : function ( ) {
33
- var namespace ;
33
+ var scope ;
34
34
35
35
this . _super ( ) ;
36
36
37
- namespace = this . dataNamespace ;
37
+ scope = this . dataScope ;
38
38
39
- if ( typeof namespace === 'string' ) {
40
- this . dataNamespace = namespace ? [ namespace ] : [ ] ;
39
+ if ( typeof scope === 'string' ) {
40
+ this . dataScope = scope ? [ scope ] : [ ] ;
41
41
}
42
42
43
43
this . _requests = [ ] ;
@@ -88,7 +88,7 @@ define([
88
88
getData : function ( params , options ) {
89
89
var cachedRequest ;
90
90
91
- if ( this . hasNamespaceChanged ( params ) ) {
91
+ if ( this . hasScopeChanged ( params ) ) {
92
92
this . clearRequests ( ) ;
93
93
} else {
94
94
cachedRequest = this . getRequest ( params ) ;
@@ -102,25 +102,27 @@ define([
102
102
} ,
103
103
104
104
/**
105
- * Tells whether one of the parameters defined in the "dataNamespace " has
105
+ * Tells whether one of the parameters defined in the "dataScope " has
106
106
* changed since the last request.
107
107
*
108
108
* @param {Object } params - Request parameters.
109
109
* @returns {Boolean }
110
110
*/
111
- hasNamespaceChanged : function ( params ) {
111
+ hasScopeChanged : function ( params ) {
112
112
var lastRequest = _ . last ( this . _requests ) ,
113
- paths ,
113
+ keys ,
114
114
diff ;
115
115
116
116
if ( ! lastRequest ) {
117
117
return false ;
118
118
}
119
119
120
120
diff = utils . compare ( lastRequest . params , params ) ;
121
- paths = _ . pluck ( diff . changes , 'path' ) . concat ( _ . keys ( diff . containers ) ) ;
122
121
123
- return _ . intersection ( this . dataNamespace , paths ) . length > 0 ;
122
+ keys = _ . pluck ( diff . changes , 'path' ) ;
123
+ keys = keys . concat ( Object . keys ( diff . containers ) ) ;
124
+
125
+ return _ . intersection ( this . dataScope , keys ) . length > 0 ;
124
126
} ,
125
127
126
128
/**
0 commit comments