| 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 |
|
| 15 |
goog.provide('goog.net.XhrLike'); |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
/** |
| 20 |
* Interface for the common parts of XMLHttpRequest. |
| 21 |
* |
| 22 |
* Mostly copied from externs/w3c_xml.js. |
| 23 |
* |
| 24 |
* @interface |
| 25 |
* @see http://www.w3.org/TR/XMLHttpRequest/ |
| 26 |
*/ |
| 27 |
goog.net.XhrLike = function() {}; |
| 28 |
|
| 29 |
|
| 30 |
/** |
| 31 |
* Typedef that refers to either native or custom-implemented XHR objects. |
| 32 |
* @typedef {!goog.net.XhrLike|!XMLHttpRequest} |
| 33 |
*/ |
| 34 |
goog.net.XhrLike.OrNative; |
| 35 |
|
| 36 |
|
| 37 |
/** |
| 38 |
* @type {function()|null|undefined} |
| 39 |
* @see http://www.w3.org/TR/XMLHttpRequest/#handler-xhr-onreadystatechange |
| 40 |
*/ |
| 41 |
goog.net.XhrLike.prototype.onreadystatechange; |
| 42 |
|
| 43 |
|
| 44 |
/** |
| 45 |
* @type {string} |
| 46 |
* @see http://www.w3.org/TR/XMLHttpRequest/#the-responsetext-attribute |
| 47 |
*/ |
| 48 |
goog.net.XhrLike.prototype.responseText; |
| 49 |
|
| 50 |
|
| 51 |
/** |
| 52 |
* @type {Document} |
| 53 |
* @see http://www.w3.org/TR/XMLHttpRequest/#the-responsexml-attribute |
| 54 |
*/ |
| 55 |
goog.net.XhrLike.prototype.responseXML; |
| 56 |
|
| 57 |
|
| 58 |
/** |
| 59 |
* @type {number} |
| 60 |
* @see http://www.w3.org/TR/XMLHttpRequest/#readystate |
| 61 |
*/ |
| 62 |
goog.net.XhrLike.prototype.readyState; |
| 63 |
|
| 64 |
|
| 65 |
/** |
| 66 |
* @type {number} |
| 67 |
* @see http://www.w3.org/TR/XMLHttpRequest/#status |
| 68 |
*/ |
| 69 |
goog.net.XhrLike.prototype.status; |
| 70 |
|
| 71 |
|
| 72 |
/** |
| 73 |
* @type {string} |
| 74 |
* @see http://www.w3.org/TR/XMLHttpRequest/#statustext |
| 75 |
*/ |
| 76 |
goog.net.XhrLike.prototype.statusText; |
| 77 |
|
| 78 |
|
| 79 |
/** |
| 80 |
* @param {string} method |
| 81 |
* @param {string} url |
| 82 |
* @param {?boolean=} opt_async |
| 83 |
* @param {?string=} opt_user |
| 84 |
* @param {?string=} opt_password |
| 85 |
* @see http://www.w3.org/TR/XMLHttpRequest/#the-open()-method |
| 86 |
*/ |
| 87 |
goog.net.XhrLike.prototype.open = function( |
| 88 |
method, url, opt_async, opt_user, opt_password) {}; |
| 89 |
|
| 90 |
|
| 91 |
/** |
| 92 |
* @param {ArrayBuffer|ArrayBufferView|Blob|Document|FormData|string=} opt_data |
| 93 |
* @see http://www.w3.org/TR/XMLHttpRequest/#the-send()-method |
| 94 |
*/ |
| 95 |
goog.net.XhrLike.prototype.send = function(opt_data) {}; |
| 96 |
|
| 97 |
|
| 98 |
/** |
| 99 |
* @see http://www.w3.org/TR/XMLHttpRequest/#the-abort()-method |
| 100 |
*/ |
| 101 |
goog.net.XhrLike.prototype.abort = function() {}; |
| 102 |
|
| 103 |
|
| 104 |
/** |
| 105 |
* @param {string} header |
| 106 |
* @param {string} value |
| 107 |
* @see http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader()-method |
| 108 |
*/ |
| 109 |
goog.net.XhrLike.prototype.setRequestHeader = function(header, value) {}; |
| 110 |
|
| 111 |
|
| 112 |
/** |
| 113 |
* @param {string} header |
| 114 |
* @return {string} |
| 115 |
* @see http://www.w3.org/TR/XMLHttpRequest/#the-getresponseheader()-method |
| 116 |
*/ |
| 117 |
goog.net.XhrLike.prototype.getResponseHeader = function(header) {}; |
| 118 |
|
| 119 |
|
| 120 |
/** |
| 121 |
* @return {string} |
| 122 |
* @see http://www.w3.org/TR/XMLHttpRequest/#the-getallresponseheaders()-method |
| 123 |
*/ |
| 124 |
goog.net.XhrLike.prototype.getAllResponseHeaders = function() {}; |