Skip to content

Commit c2eaa1a

Browse files
Shuwen QianDan Lasky
authored andcommitted
Rename params to query
1 parent d9f2530 commit c2eaa1a

8 files changed

Lines changed: 30 additions & 30 deletions

File tree

src/mm-ajax/doc.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,14 @@
8686
"name":"exec",
8787
"description":"Triggers the XHR call.",
8888
"arguments":[
89-
{
89+
{
9090
"name":"data",
9191
"type":"Object",
9292
"optional":true,
9393
"default":"undefined",
9494
"description":"Optional body data to be passed with the call if this.body is or when it is desired to override"
9595
},
96-
{
96+
{
9797
"name":"options",
9898
"type":"Object",
9999
"optional":true,
@@ -106,14 +106,14 @@
106106
"name":"queue",
107107
"description":"Enqueus the XHR call to be triggered by execQueue. Returns the promise for the call being queued.",
108108
"arguments":[
109-
{
109+
{
110110
"name":"data",
111111
"type":"Object",
112112
"optional":true,
113113
"default":"undefined",
114114
"description":"Optional body data to be passed with the call if this.body is or when it is desired to override"
115115
},
116-
{
116+
{
117117
"name":"options",
118118
"type":"Object",
119119
"optional":true,
@@ -152,7 +152,7 @@
152152
"name":"addHeader",
153153
"description":"Adds a header name/value pair to the headers array.",
154154
"arguments":[
155-
{
155+
{
156156
"name":"name",
157157
"type":"String",
158158
"optional":false,
@@ -170,9 +170,9 @@
170170
},
171171
{
172172
"name":"addParam",
173-
"description":"Adds a queryString name/value pair to the params array.",
174-
"arguments":[
175-
{
173+
"description":"Adds a queryString name/value pair to the query array.",
174+
"arguments":[
175+
{
176176
"name":"name",
177177
"type":"String",
178178
"optional":false,
@@ -191,8 +191,8 @@
191191
{
192192
"name":"addUrlParam",
193193
"description":"Adds a url chunk to the urlParams array. Useful for ids or other dynamic url parts. / is added automatically.",
194-
"arguments":[
195-
{
194+
"arguments":[
195+
{
196196
"name":"name",
197197
"type":"String",
198198
"optional":false,
@@ -271,4 +271,4 @@
271271
"articles":[
272272
"data_comps_using_ajax"
273273
]
274-
}
274+
}

src/mm-ajax/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
}
3737
</style>
3838
<template>
39-
<mm-ajax id="ajax" url="{{url}}" method="GET" params="{{params}}" auto response="{{response}}" on-data-error="log" on-data-ready="log" on-data-result="log" on-data-progress="log" on-data-abort="log" debug></mm-ajax>
39+
<mm-ajax id="ajax" url="{{url}}" method="GET" query="{{query}}" auto response="{{response}}" on-data-error="log" on-data-ready="log" on-data-result="log" on-data-progress="log" on-data-abort="log" debug></mm-ajax>
4040
<mm-input id="url" value="{{url}}"></mm-input>
41-
<mm-input id="params" value="{{params}}"></mm-input>
41+
<mm-input id="query" value="{{query}}"></mm-input>
4242
<mm-button id="btn" on-click="update">
4343
<label>
4444
Go!
@@ -81,7 +81,7 @@
8181
type: String,
8282
value: "http://localhost:8000/ajax"
8383
},
84-
params: {
84+
query: {
8585
type: String,
8686
value: '[{"name":"cake","value":100}]'
8787
},

src/mm-ajax/mm-ajax.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
value:"",
3030
observer:"_updateOpts"
3131
},
32-
params: {
32+
query: {
3333
type: String,
3434
value: "",
3535
observer:"_updateOpts"
@@ -110,7 +110,7 @@
110110
method:this.method,
111111
url:this.url,
112112
body:this.body,
113-
params:this.params,
113+
query:this.query,
114114
withCredentials:this.withCredentials,
115115
timeout:this.timeout,
116116
concurrency:this.concurrency

src/shared/behaviors/domsyncable.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
function _getParamBase(obj) {
1515
obj = obj || {};
1616
return {
17-
params: obj.queryparam || [],
17+
query: obj.queryparam || [],
1818
urlParams: obj.urlparam || [],
1919
headers: obj.header || []
2020
};
@@ -63,7 +63,7 @@
6363

6464
return {
6565
headers: domConfig.headers.map(DataUtils.nodeToParam),
66-
params: domConfig.params.map(DataUtils.nodeToParam),
66+
query: domConfig.query.map(DataUtils.nodeToParam),
6767
urlParams: domConfig.urlParams.map(DataUtils.nodeInnerValue)
6868
};
6969
},

src/shared/js/ajax.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
options = copy({}, this.options, options);
107107

108108
var url = this.serializeUrl(options.url, options.urlParams);
109-
url = this.serializeParams(url, options.params);
109+
url = this.serializeQuery(url, options.query);
110110
data = this.setRequestData(options.method, options.contentType, data, options.body);
111111

112112
return new StrandLib.Request(copy(options, {
@@ -148,8 +148,8 @@
148148
},
149149

150150
addParam: function(name, value) {
151-
this.options.params = this.params || [];
152-
this.options.params.push({name:name, value:value});
151+
this.options.query = this.query || [];
152+
this.options.query.push({name:name, value:value});
153153
},
154154

155155
addUrlParam: function(param) {
@@ -205,8 +205,8 @@
205205
return url;
206206
},
207207

208-
serializeParams: function(url, params) {
209-
if (params && params.length) {
208+
serializeQuery: function(url, query) {
209+
if (query && query.length) {
210210
if (url.indexOf("?") !== -1) {
211211
var last = url.slice(-1);
212212
if (last !== "&" && last !== "?") {
@@ -215,7 +215,7 @@
215215
} else {
216216
url += "?";
217217
}
218-
url += this.serialize(params).join("&");
218+
url += this.serialize(query).join("&");
219219
}
220220
return url;
221221
},

src/shared/js/ajaxbusterplugin.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
scope.AjaxBusterPlugin.prototype = {
2222
requestHandler: function(ajaxOptions) {
23-
var qp = DataUtils.getPathValue("params", ajaxOptions);
23+
var qp = DataUtils.getPathValue("query", ajaxOptions);
2424
if (this.config.enabled && qp) {
2525
qp.push(DataUtils.param(this.config.name, Date.now()));
2626
}

src/shared/js/ajaxpageplugin.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
function _getParamBase(obj) {
77
return DataUtils.copy({
8-
params:[],
8+
query:[],
99
urlParams:[],
1010
headers:[]
1111
},obj);
@@ -59,8 +59,8 @@
5959
}
6060
}
6161
if (opts.query) {
62-
if (opts.pageName) ajaxOpts.params.push(DataUtils.param(opts.pageName, page));
63-
if (opts.sizeName) ajaxOpts.params.push(DataUtils.param(opts.sizeName, opts.pageSize));
62+
if (opts.pageName) ajaxOpts.query.push(DataUtils.param(opts.pageName, page));
63+
if (opts.sizeName) ajaxOpts.query.push(DataUtils.param(opts.sizeName, opts.pageSize));
6464
}
6565
if (opts.body && DataUtils.isType(ajaxOpts.body, "object")) {
6666
if (opts.pageName) ajaxOpts.body[opts.pageName] = page;

src/shared/js/sync.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
function _getParamBase(obj) {
3636
obj = obj || {};
3737
return {
38-
params: obj.queryparam || [],
38+
query: obj.queryparam || [],
3939
urlParams: obj.urlparam || [],
4040
headers: obj.header || []
4141
};
@@ -48,7 +48,7 @@
4848
if (DataUtils.isType(cur,"object")) {
4949
for(var i in cur) {
5050
switch(i) {
51-
case "params":
51+
case "query":
5252
case "headers":
5353
case "urlParams":
5454
if (cur[i].length > 0) {

0 commit comments

Comments
 (0)