XMLHttpRequest.hx 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /*
  2. * Copyright (C)2005-2018 Haxe Foundation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  20. * DEALINGS IN THE SOFTWARE.
  21. */
  22. // This file is generated from mozilla\XMLHttpRequest.webidl. Do not edit!
  23. package js.html;
  24. /**
  25. Use `XMLHttpRequest` (XHR) objects to interact with servers. You can retrieve data from a URL without having to do a full page refresh. This enables a Web page to update just part of a page without disrupting what the user is doing.
  26. Documentation [XMLHttpRequest](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
  27. @see <https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest>
  28. **/
  29. @:native("XMLHttpRequest")
  30. extern class XMLHttpRequest extends XMLHttpRequestEventTarget
  31. {
  32. static inline var UNSENT : Int = 0;
  33. static inline var OPENED : Int = 1;
  34. static inline var HEADERS_RECEIVED : Int = 2;
  35. static inline var LOADING : Int = 3;
  36. static inline var DONE : Int = 4;
  37. /**
  38. An `EventHandler` that is called whenever the `readyState` attribute changes.
  39. **/
  40. var onreadystatechange : haxe.Constraints.Function;
  41. /**
  42. Returns an `unsigned short`, the state of the request.
  43. **/
  44. var readyState(default,null) : Int;
  45. /**
  46. Is an `unsigned long` representing the number of milliseconds a request can take before automatically being terminated.
  47. **/
  48. var timeout : Int;
  49. /**
  50. Is a `Boolean` that indicates whether or not cross-site `Access-Control` requests should be made using credentials such as cookies or authorization headers.
  51. **/
  52. var withCredentials : Bool;
  53. /**
  54. Is an `XMLHttpRequestUpload`, representing the upload process.
  55. **/
  56. var upload(default,null) : XMLHttpRequestUpload;
  57. /**
  58. Returns the serialized URL of the response or the empty string if the URL is null.
  59. **/
  60. var responseURL(default,null) : String;
  61. /**
  62. Returns an `unsigned short` with the status of the response of the request.
  63. **/
  64. var status(default,null) : Int;
  65. /**
  66. Returns a `DOMString` containing the response string returned by the HTTP server. Unlike `XMLHTTPRequest.status`, this includes the entire text of the response message ("`200 OK`", for example).
  67. **/
  68. var statusText(default,null) : String;
  69. /**
  70. Is an enumerated value that defines the response type.
  71. **/
  72. var responseType : XMLHttpRequestResponseType;
  73. /**
  74. Returns an `ArrayBuffer`, `Blob`, `Document`, JavaScript object, or a `DOMString`, depending on the value of `XMLHttpRequest.responseType`. that contains the response entity body.
  75. **/
  76. var response(default,null) : Dynamic;
  77. /**
  78. Returns a `DOMString` that contains the response to the request as text, or `null` if the request was unsuccessful or has not yet been sent.
  79. **/
  80. var responseText(default,null) : String;
  81. /**
  82. Returns a `Document` containing the response to the request, or `null` if the request was unsuccessful, has not yet been sent, or cannot be parsed as XML or HTML.
  83. **/
  84. var responseXML(default,null) : HTMLDocument;
  85. /** @throws DOMError */
  86. @:overload( function( ?params : Dynamic/*MISSING MozXMLHttpRequestParameters*/ ) : Void {} )
  87. function new( ignored : String ) : Void;
  88. /**
  89. Initializes a request. This method is to be used from JavaScript code; to initialize a request from native code, use `openRequest()` instead.
  90. @throws DOMError
  91. **/
  92. @:overload( function( method : String, url : String ) : Void {} )
  93. function open( method : String, url : String, async : Bool, ?user : String, ?password : String ) : Void;
  94. /**
  95. Sets the value of an HTTP request header. You must call `setRequestHeader()`after `open()`, but before `send()`.
  96. @throws DOMError
  97. **/
  98. function setRequestHeader( header : String, value : String ) : Void;
  99. /**
  100. Sends the request. If the request is asynchronous (which is the default), this method returns as soon as the request is sent.
  101. @throws DOMError
  102. **/
  103. @:overload( function( ?body : Blob) : Void {} )
  104. @:overload( function( ?body : ArrayBufferView) : Void {} )
  105. @:overload( function( ?body : ArrayBuffer) : Void {} )
  106. @:overload( function( ?body : FormData) : Void {} )
  107. @:overload( function( ?body : URLSearchParams) : Void {} )
  108. @:overload( function( ?body : String) : Void {} )
  109. function send( ?body : HTMLDocument ) : Void;
  110. /**
  111. Aborts the request if it has already been sent.
  112. @throws DOMError
  113. **/
  114. function abort() : Void;
  115. /**
  116. Returns the string containing the text of the specified header, or `null` if either the response has not yet been received or the header doesn't exist in the response.
  117. @throws DOMError
  118. **/
  119. function getResponseHeader( header : String ) : String;
  120. /**
  121. Returns all the response headers, separated by CRLF, as a string, or `null` if no response has been received.
  122. @throws DOMError
  123. **/
  124. function getAllResponseHeaders() : String;
  125. /**
  126. Overrides the MIME type returned by the server.
  127. @throws DOMError
  128. **/
  129. function overrideMimeType( mime : String ) : Void;
  130. }