2
0

XMLHttpRequest.hx 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /*
  2. * Copyright (C)2005-2019 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. static inline var UNSENT : Int = 0;
  32. static inline var OPENED : Int = 1;
  33. static inline var HEADERS_RECEIVED : Int = 2;
  34. static inline var LOADING : Int = 3;
  35. static inline var DONE : Int = 4;
  36. /**
  37. An `EventHandler` that is called whenever the `readyState` attribute changes.
  38. **/
  39. var onreadystatechange : haxe.Constraints.Function;
  40. /**
  41. Returns an `unsigned short`, the state of the request.
  42. **/
  43. var readyState(default,null) : Int;
  44. /**
  45. Is an `unsigned long` representing the number of milliseconds a request can take before automatically being terminated.
  46. **/
  47. var timeout : Int;
  48. /**
  49. Is a `Boolean` that indicates whether or not cross-site `Access-Control` requests should be made using credentials such as cookies or authorization headers.
  50. **/
  51. var withCredentials : Bool;
  52. /**
  53. Is an `XMLHttpRequestUpload`, representing the upload process.
  54. **/
  55. var upload(default,null) : XMLHttpRequestUpload;
  56. /**
  57. Returns the serialized URL of the response or the empty string if the URL is null.
  58. **/
  59. var responseURL(default,null) : String;
  60. /**
  61. Returns an `unsigned short` with the status of the response of the request.
  62. **/
  63. var status(default,null) : Int;
  64. /**
  65. 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).
  66. **/
  67. var statusText(default,null) : String;
  68. /**
  69. Is an enumerated value that defines the response type.
  70. **/
  71. var responseType : XMLHttpRequestResponseType;
  72. /**
  73. Returns an `ArrayBuffer`, `Blob`, `Document`, JavaScript object, or a `DOMString`, depending on the value of `XMLHttpRequest.responseType`. that contains the response entity body.
  74. **/
  75. var response(default,null) : Dynamic;
  76. /**
  77. 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.
  78. **/
  79. var responseText(default,null) : String;
  80. /**
  81. 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.
  82. **/
  83. var responseXML(default,null) : HTMLDocument;
  84. /** @throws DOMError */
  85. @:overload( function( ?params : Dynamic/*MISSING MozXMLHttpRequestParameters*/ ) : Void {} )
  86. function new( ignored : String ) : Void;
  87. /**
  88. Initializes a request. This method is to be used from JavaScript code; to initialize a request from native code, use `openRequest()` instead.
  89. @throws DOMError
  90. **/
  91. @:overload( function( method : String, url : String ) : Void {} )
  92. function open( method : String, url : String, async : Bool, ?user : String, ?password : String ) : Void;
  93. /**
  94. Sets the value of an HTTP request header. You must call `setRequestHeader()`after `open()`, but before `send()`.
  95. @throws DOMError
  96. **/
  97. function setRequestHeader( header : String, value : String ) : Void;
  98. /**
  99. Sends the request. If the request is asynchronous (which is the default), this method returns as soon as the request is sent.
  100. @throws DOMError
  101. **/
  102. @:overload( function( ?body : Blob) : Void {} )
  103. @:overload( function( ?body : js.lib.ArrayBufferView) : Void {} )
  104. @:overload( function( ?body : js.lib.ArrayBuffer) : Void {} )
  105. @:overload( function( ?body : FormData) : Void {} )
  106. @:overload( function( ?body : URLSearchParams) : Void {} )
  107. @:overload( function( ?body : String) : Void {} )
  108. function send( ?body : HTMLDocument ) : Void;
  109. /**
  110. Aborts the request if it has already been sent.
  111. @throws DOMError
  112. **/
  113. function abort() : Void;
  114. /**
  115. 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.
  116. @throws DOMError
  117. **/
  118. function getResponseHeader( header : String ) : String;
  119. /**
  120. Returns all the response headers, separated by CRLF, as a string, or `null` if no response has been received.
  121. @throws DOMError
  122. **/
  123. function getAllResponseHeaders() : String;
  124. /**
  125. Overrides the MIME type returned by the server.
  126. @throws DOMError
  127. **/
  128. function overrideMimeType( mime : String ) : Void;
  129. }