123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129(* Js_of_ocaml library
* http://www.ocsigen.org/js_of_ocaml/
* Copyright (C) 2010 Jérôme Vouillon
* Laboratoire PPS - CNRS Université Paris Diderot
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, with linking exception;
* either version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)openJsopen!ImporttypereadyState=|UNSENT|OPENED|HEADERS_RECEIVED|LOADING|DONEtype_response=|ArrayBuffer:Typed_array.arrayBuffertOpt.tresponse|Blob:#File.blobtOpt.tresponse|Document:Dom.elementDom.documenttOpt.tresponse|JSON:'aOpt.tresponse|Text:js_stringtresponse|Default:stringresponseclasstypexmlHttpRequest=object('self)methodonreadystatechange:(unit->unit)Js.callbackJs.writeonly_propmethodreadyState:readyStatereadonly_propmethod_open:js_stringt->js_stringt->boolt->unitmethmethod_open_full:js_stringt->js_stringt->boolt->js_stringtopt->js_stringtopt->unitmethmethodsetRequestHeader:js_stringt->js_stringt->unitmethmethodoverrideMimeType:js_stringt->unitmethmethodsend:js_stringtopt->unitmethmethodsend_blob:#File.blobt->unitmethmethodsend_document:Dom.elementDom.documentt->unitmethmethodsend_formData:Form.formDatat->unitmethmethodabort:unitmethmethodstatus:intreadonly_propmethodstatusText:js_stringtreadonly_propmethodgetResponseHeader:js_stringt->js_stringtoptmethmethodgetAllResponseHeaders:js_stringtmethmethodresponse:File.file_anyreadonly_propmethodresponseText:js_stringtoptreadonly_propmethodresponseXML:Dom.elementDom.documenttoptreadonly_propmethodresponseType:js_stringtpropmethodwithCredentials:booltwriteonly_propinheritFile.progressEventTargetmethodontimeout:('selft,'selfFile.progressEventt)Dom.event_listenerwriteonly_propmethodupload:xmlHttpRequestUploadtoptdefreadonly_propendandxmlHttpRequestUpload=object('self)inheritFile.progressEventTargetendmoduleEvent=structtypetyp=xmlHttpRequestFile.progressEventtDom.Event.typletreadystatechange=Dom.Event.make"readystatechange"letloadstart=Dom.Event.make"loadstart"letprogress=Dom.Event.make"progress"letabort=Dom.Event.make"abort"leterror=Dom.Event.make"error"letload=Dom.Event.make"load"lettimeout=Dom.Event.make"timeout"letloadend=Dom.Event.make"loadend"endletcreate():xmlHttpRequestJs.t=letxmlHttpRequest=Js.Unsafe.global##._XMLHttpRequestinletactiveXObject=Js.Unsafe.global##.activeXObjectintrynew%jsxmlHttpRequestwith_->(trynew%jsactiveXObject(Js.string"Msxml2.XMLHTTP")with_->(trynew%jsactiveXObject(Js.string"Msxml3.XMLHTTP")with_->(trynew%jsactiveXObject(Js.string"Microsoft.XMLHTTP")with_->assertfalse)))