Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: polymer_0.5.4/bower_components/core-ajax/core-ajax.html

Issue 895523005: Added Polymer 0.5.4 (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!-- 1 <!--
2 Copyright (c) 2014 The Polymer Project Authors. All rights reserved. 2 Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
3 This code may only be used under the BSD style license found at http://polymer.g ithub.io/LICENSE.txt 3 This code may only be used under the BSD style license found at http://polymer.g ithub.io/LICENSE.txt
4 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 4 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
5 The complete set of contributors may be found at http://polymer.github.io/CONTRI BUTORS.txt 5 The complete set of contributors may be found at http://polymer.github.io/CONTRI BUTORS.txt
6 Code distributed by Google as part of the polymer project is also 6 Code distributed by Google as part of the polymer project is also
7 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS.txt 7 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS.txt
8 --> 8 -->
9 9
10 <!-- 10 <!--
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 * @attribute auto 93 * @attribute auto
94 * @type boolean 94 * @type boolean
95 * @default false 95 * @default false
96 */ 96 */
97 auto: false, 97 auto: false,
98 98
99 /** 99 /**
100 * Parameters to send to the specified URL, as JSON. 100 * Parameters to send to the specified URL, as JSON.
101 * 101 *
102 * @attribute params 102 * @attribute params
103 * @type string (JSON) 103 * @type string
104 * @default '' 104 * @default ''
105 */ 105 */
106 params: '', 106 params: '',
107 107
108 /** 108 /**
109 * The response for the current request, or null if it hasn't 109 * The response for the current request, or null if it hasn't
110 * completed yet or the request resulted in error. 110 * completed yet or the request resulted in error.
111 * 111 *
112 * @attribute response 112 * @attribute response
113 * @type Object 113 * @type Object
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 340
341 // TODO(sorvell): multiple side-effects could call autoGo 341 // TODO(sorvell): multiple side-effects could call autoGo
342 // during one micro-task, use a job to have only one action 342 // during one micro-task, use a job to have only one action
343 // occur 343 // occur
344 autoGo: function() { 344 autoGo: function() {
345 if (this.auto) { 345 if (this.auto) {
346 this.goJob = this.job(this.goJob, this.go, 0); 346 this.goJob = this.job(this.goJob, this.go, 0);
347 } 347 }
348 }, 348 },
349 349
350 getParams: function(params) {
351 params = this.params || params;
352 if (params && typeof(params) == 'string') {
353 params = JSON.parse(params);
354 }
355 return params;
356 },
357
350 /** 358 /**
351 * Performs an Ajax request to the specified URL. 359 * Performs an Ajax request to the specified URL.
352 * 360 *
353 * @method go 361 * @method go
354 */ 362 */
355 go: function() { 363 go: function() {
356 var args = this.xhrArgs || {}; 364 var args = this.xhrArgs || {};
357 // TODO(sjmiles): we may want XHR to default to POST if body is set 365 // TODO(sjmiles): we may want XHR to default to POST if body is set
358 args.body = this.body || args.body; 366 args.body = this.body || args.body;
359 args.params = this.params || args.params; 367 args.params = this.getParams(args.params);
360 if (args.params && typeof(args.params) == 'string') {
361 args.params = JSON.parse(args.params);
362 }
363 args.headers = this.headers || args.headers || {}; 368 args.headers = this.headers || args.headers || {};
364 if (args.headers && typeof(args.headers) == 'string') { 369 if (args.headers && typeof(args.headers) == 'string') {
365 args.headers = JSON.parse(args.headers); 370 args.headers = JSON.parse(args.headers);
366 } 371 }
367 var hasContentType = Object.keys(args.headers).some(function (header) { 372 var hasContentType = Object.keys(args.headers).some(function (header) {
368 return header.toLowerCase() === 'content-type'; 373 return header.toLowerCase() === 'content-type';
369 }); 374 });
370 // No Content-Type should be specified if sending `FormData`. 375 // No Content-Type should be specified if sending `FormData`.
371 // The UA must set the Content-Type w/ a calculated multipart boundary ID . 376 // The UA must set the Content-Type w/ a calculated multipart boundary ID .
372 if (args.body instanceof FormData) { 377 if (args.body instanceof FormData) {
(...skipping 23 matching lines...) Expand all
396 function(progress) { 401 function(progress) {
397 this.processProgress(progress, activeRequest); 402 this.processProgress(progress, activeRequest);
398 }.bind(this), false); 403 }.bind(this), false);
399 } else { 404 } else {
400 this.progress = { 405 this.progress = {
401 lengthComputable: false, 406 lengthComputable: false,
402 } 407 }
403 } 408 }
404 } 409 }
405 return this.activeRequest; 410 return this.activeRequest;
411 },
412
413 /**
414 * Aborts the current active request if there is one and resets internal
415 * state appropriately.
416 *
417 * @method abort
418 */
419 abort: function() {
420 if (!this.activeRequest) return;
421 this.activeRequest.abort();
422 this.activeRequest = null;
423 this.progress = {};
424 this.loading = false;
406 } 425 }
407 426
408 }); 427 });
409 428
410 </script> 429 </script>
411 </polymer-element> 430 </polymer-element>
OLDNEW
« no previous file with comments | « polymer_0.5.4/bower_components/core-ajax/bower.json ('k') | polymer_0.5.4/bower_components/core-ajax/core-xhr.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698