xhrlike.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. // Copyright 2013 The Closure Library Authors. All Rights Reserved.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS-IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. goog.provide('goog.net.XhrLike');
  15. /**
  16. * Interface for the common parts of XMLHttpRequest.
  17. *
  18. * Mostly copied from externs/w3c_xml.js.
  19. *
  20. * @interface
  21. * @see http://www.w3.org/TR/XMLHttpRequest/
  22. */
  23. goog.net.XhrLike = function() {};
  24. /**
  25. * Typedef that refers to either native or custom-implemented XHR objects.
  26. * @typedef {!goog.net.XhrLike|!XMLHttpRequest}
  27. */
  28. goog.net.XhrLike.OrNative;
  29. /**
  30. * @type {function()|null|undefined}
  31. * @see http://www.w3.org/TR/XMLHttpRequest/#handler-xhr-onreadystatechange
  32. */
  33. goog.net.XhrLike.prototype.onreadystatechange;
  34. /**
  35. * @type {string}
  36. * @see http://www.w3.org/TR/XMLHttpRequest/#the-responsetext-attribute
  37. */
  38. goog.net.XhrLike.prototype.responseText;
  39. /**
  40. * @type {Document}
  41. * @see http://www.w3.org/TR/XMLHttpRequest/#the-responsexml-attribute
  42. */
  43. goog.net.XhrLike.prototype.responseXML;
  44. /**
  45. * @type {number}
  46. * @see http://www.w3.org/TR/XMLHttpRequest/#readystate
  47. */
  48. goog.net.XhrLike.prototype.readyState;
  49. /**
  50. * @type {number}
  51. * @see http://www.w3.org/TR/XMLHttpRequest/#status
  52. */
  53. goog.net.XhrLike.prototype.status;
  54. /**
  55. * @type {string}
  56. * @see http://www.w3.org/TR/XMLHttpRequest/#statustext
  57. */
  58. goog.net.XhrLike.prototype.statusText;
  59. /**
  60. * @param {string} method
  61. * @param {string} url
  62. * @param {?boolean=} opt_async
  63. * @param {?string=} opt_user
  64. * @param {?string=} opt_password
  65. * @see http://www.w3.org/TR/XMLHttpRequest/#the-open()-method
  66. */
  67. goog.net.XhrLike.prototype.open = function(
  68. method, url, opt_async, opt_user, opt_password) {};
  69. /**
  70. * @param {ArrayBuffer|ArrayBufferView|Blob|Document|FormData|string=} opt_data
  71. * @see http://www.w3.org/TR/XMLHttpRequest/#the-send()-method
  72. */
  73. goog.net.XhrLike.prototype.send = function(opt_data) {};
  74. /**
  75. * @see http://www.w3.org/TR/XMLHttpRequest/#the-abort()-method
  76. */
  77. goog.net.XhrLike.prototype.abort = function() {};
  78. /**
  79. * @param {string} header
  80. * @param {string} value
  81. * @see http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader()-method
  82. */
  83. goog.net.XhrLike.prototype.setRequestHeader = function(header, value) {};
  84. /**
  85. * @param {string} header
  86. * @return {string}
  87. * @see http://www.w3.org/TR/XMLHttpRequest/#the-getresponseheader()-method
  88. */
  89. goog.net.XhrLike.prototype.getResponseHeader = function(header) {};
  90. /**
  91. * @return {string}
  92. * @see http://www.w3.org/TR/XMLHttpRequest/#the-getallresponseheaders()-method
  93. */
  94. goog.net.XhrLike.prototype.getAllResponseHeaders = function() {};