Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file js.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760(* 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.
*)open!Importtype+'attype(-'a,+'b)meth_callbackmoduleUnsafe=structtypetoptypeany=topttypeany_js_array=anyexternalinject:'a->any="%identity"externalcoerce:_t->_t="%identity"externalget:'a->'b->'c="caml_js_get"externalset:'a->'b->'c->unit="caml_js_set"externaldelete:'a->'b->unit="caml_js_delete"externalcall:'a->'b->anyarray->'c="caml_js_call"externalfun_call:'a->anyarray->'b="caml_js_fun_call"externalmeth_call:'a->string->anyarray->'b="caml_js_meth_call"externalnew_obj:'a->anyarray->'b="caml_js_new"externalnew_obj_arr:'a->any_js_array->'b="caml_ojs_new_arr"externalobj:(string*any)array->'a="caml_js_object"externalequals:'a->'b->bool="caml_js_equals"externalpure_expr:(unit->'a)->'a="caml_js_pure_expr"externaleval_string:string->'a="caml_js_eval_string"externaljs_expr:string->'a="caml_js_expr"externalpure_js_expr:string->'a="caml_pure_js_expr"letglobal=pure_js_expr"joo_global_object"externalcallback:('a->'b)->('c,'a->'b)meth_callback="%identity"externalcallback_with_arguments:(any_js_array->'b)->('c,any_js_array->'b)meth_callback="caml_js_wrap_callback_arguments"externalcallback_with_arity:int->('a->'b)->('c,'a->'b)meth_callback="caml_js_wrap_callback_strict"externalmeth_callback:('b->'a)->('b,'a)meth_callback="caml_js_wrap_meth_callback_unsafe"externalmeth_callback_with_arity:int->('b->'a)->('b,'a)meth_callback="caml_js_wrap_meth_callback_strict"externalmeth_callback_with_arguments:('b->any_js_array->'a)->('b,any_js_array->'a)meth_callback="caml_js_wrap_meth_callback_arguments"(* DEPRECATED *)externalvariable:string->'a="caml_js_var"end(****)type'aopt='atype'aoptdef='aexternaldebugger:unit->unit="debugger"letnull:'aopt=Unsafe.pure_js_expr"null"externalsome:'a->'aopt="%identity"letundefined:'aoptdef=Unsafe.pure_js_expr"undefined"externaldef:'a->'aoptdef="%identity"moduletypeOPT=sigtype'atvalempty:'atvalreturn:'a->'atvalmap:'at->('a->'b)->'btvalbind:'at->('a->'bt)->'btvaltest:'at->boolvaliter:'at->('a->unit)->unitvalcase:'at->(unit->'b)->('a->'b)->'bvalget:'at->(unit->'a)->'avaloption:'aoption->'atvalto_option:'at->'aoptionendmoduleOpt:OPTwithtype'at='aopt=structtype'at='aoptletempty=nullletreturn=someletmapxf=ifUnsafe.equalsxnullthennullelsereturn(fx)letbindxf=ifUnsafe.equalsxnullthennullelsefxlettestx=not(Unsafe.equalsxnull)letiterxf=ifnot(Unsafe.equalsxnull)thenfxletcasexfg=ifUnsafe.equalsxnullthenf()elsegxletgetxf=ifUnsafe.equalsxnullthenf()elsexletoptionx=matchxwith|None->empty|Somex->returnxletto_optionx=casex(fun()->None)(funx->Somex)endmoduleOptdef:OPTwithtype'at='aoptdef=structtype'at='aoptdefletempty=undefinedletreturn=defletmapxf=ifx==undefinedthenundefinedelsereturn(fx)letbindxf=ifx==undefinedthenundefinedelsefxlettestx=x!=undefinedletiterxf=ifx!=undefinedthenfxletcasexfg=ifx==undefinedthenf()elsegxletgetxf=ifx==undefinedthenf()elsexletoptionx=matchxwith|None->empty|Somex->returnxletto_optionx=casex(fun()->None)(funx->Somex)end(****)letcoercexfg=Opt.get(fx)(fun()->gx)letcoerce_optxfg=Opt.get(Opt.bindxf)(fun()->gx)(****)type+'amethtype+'agen_proptype'areadonly_prop=<get:'a>gen_proptype'awriteonly_prop=<set:'a->unit>gen_proptype'aprop=<get:'a;set:'a->unit>gen_proptype'aoptdef_prop=<get:'aoptdef;set:'a->unit>gen_proptype+'aconstr(****)type'acallback=(unit,'a)meth_callbackexternalwrap_callback:('a->'b)->('c,'a->'b)meth_callback="caml_js_wrap_callback"externalwrap_meth_callback:('a->'b)->('a,'b)meth_callback="caml_js_wrap_meth_callback"(****)let_true=Unsafe.pure_js_expr"true"let_false=Unsafe.pure_js_expr"false"typematch_result_handletypestring_arrayclasstypejs_string=objectmethodtoString:js_stringtmethmethodvalueOf:js_stringtmethmethodcharAt:int->js_stringtmethmethodcharCodeAt:int->floatmeth(* This may return NaN... *)methodconcat:js_stringt->js_stringtmethmethodconcat_2:js_stringt->js_stringt->js_stringtmethmethodconcat_3:js_stringt->js_stringt->js_stringt->js_stringtmethmethodconcat_4:js_stringt->js_stringt->js_stringt->js_stringt->js_stringtmethmethodindexOf:js_stringt->intmethmethodindexOf_from:js_stringt->int->intmethmethodlastIndexOf:js_stringt->intmethmethodlastIndexOf_from:js_stringt->int->intmethmethodlocaleCompare:js_stringt->floatmethmethod_match:regExpt->match_result_handletoptmethmethodreplace:regExpt->js_stringt->js_stringtmethmethodreplace_string:js_stringt->js_stringt->js_stringtmethmethodsearch:regExpt->intmethmethodslice:int->int->js_stringtmethmethodslice_end:int->js_stringtmethmethodsplit:js_stringt->string_arraytmethmethodsplit_limited:js_stringt->int->string_arraytmethmethodsplit_regExp:regExpt->string_arraytmethmethodsplit_regExpLimited:regExpt->int->string_arraytmethmethodsubstring:int->int->js_stringtmethmethodsubstring_toEnd:int->js_stringtmethmethodtoLowerCase:js_stringtmethmethodtoLocaleLowerCase:js_stringtmethmethodtoUpperCase:js_stringtmethmethodtoLocaleUpperCase:js_stringtmethmethodtrim:js_stringtmethmethodlength:intreadonly_propendandregExp=objectmethodexec:js_stringt->match_result_handletoptmethmethodtest:js_stringt->booltmethmethodtoString:js_stringtmethmethodsource:js_stringtreadonly_propmethodglobal:booltreadonly_propmethodignoreCase:booltreadonly_propmethodmultiline:booltreadonly_propmethodlastIndex:intpropendclasstypestring_constr=objectmethodfromCharCode:int->js_stringtmethendletstring_constr=Unsafe.global##._StringletregExp=Unsafe.global##._RegExpletregExp_copy=regExpletregExp_withFlags=regExpclasstype['a]js_array=objectmethodtoString:js_stringtmethmethodtoLocaleString:js_stringtmethmethodconcat:'ajs_arrayt->'ajs_arraytmethmethodjoin:js_stringt->js_stringtmethmethodpop:'aoptdefmethmethodpush:'a->intmethmethodpush_2:'a->'a->intmethmethodpush_3:'a->'a->'a->intmethmethodpush_4:'a->'a->'a->'a->intmethmethodreverse:'ajs_arraytmethmethodshift:'aoptdefmethmethodslice:int->int->'ajs_arraytmethmethodslice_end:int->'ajs_arraytmethmethodsort:('a->'a->float)callback->'ajs_arraytmethmethodsort_asStrings:'ajs_arraytmethmethodsplice:int->int->'ajs_arraytmethmethodsplice_1:int->int->'a->'ajs_arraytmethmethodsplice_2:int->int->'a->'a->'ajs_arraytmethmethodsplice_3:int->int->'a->'a->'a->'ajs_arraytmethmethodsplice_4:int->int->'a->'a->'a->'a->'ajs_arraytmethmethodunshift:'a->intmethmethodunshift_2:'a->'a->intmethmethodunshift_3:'a->'a->'a->intmethmethodunshift_4:'a->'a->'a->'a->intmethmethodsome:('a->int->'ajs_arrayt->boolt)callback->booltmethmethodevery:('a->int->'ajs_arrayt->boolt)callback->booltmethmethodforEach:('a->int->'ajs_arrayt->unit)callback->unitmethmethodmap:('a->int->'ajs_arrayt->'b)callback->'bjs_arraytmethmethodfilter:('a->int->'ajs_arrayt->boolt)callback->'ajs_arraytmethmethodreduce_init:('b->'a->int->'ajs_arrayt->'b)callback->'b->'bmethmethodreduce:('a->'a->int->'ajs_arrayt->'a)callback->'amethmethodreduceRight_init:('b->'a->int->'ajs_arrayt->'b)callback->'b->'bmethmethodreduceRight:('a->'a->int->'ajs_arrayt->'a)callback->'amethmethodlength:intpropendletobject_constructor=Unsafe.global##._Objectletobject_keyso:js_stringtjs_arrayt=object_constructor##keysoletarray_constructor=Unsafe.global##._Arrayletarray_empty=array_constructorletarray_length=array_constructorletarray_get:'a#js_arrayt->int->'aoptdef=Unsafe.getletarray_set:'a#js_arrayt->int->'a->unit=Unsafe.setletarray_map_poly:'a#js_arrayt->('a->int->'a#js_arrayt->'b)callback->'b#js_arrayt=funacb->(Unsafe.coercea)##mapcbletarray_mapfa=array_map_polya(wrap_callback(funx_idx_->fx))letarray_mapifa=array_map_polya(wrap_callback(funxidx_->fidxx))classtypematch_result=objectinherit[js_stringt]js_arraymethodindex:intreadonly_propmethodinput:js_stringtreadonly_propendletstr_array:string_arrayt->js_stringtjs_arrayt=Unsafe.coerceletmatch_result:match_result_handlet->match_resultt=Unsafe.coerceclasstypenumber=objectmethodtoString:js_stringtmethmethodtoString_radix:int->js_stringtmethmethodtoLocaleString:js_stringtmethmethodtoFixed:int->js_stringtmethmethodtoExponential:js_stringtmethmethodtoExponential_digits:int->js_stringtmethmethodtoPrecision:int->js_stringtmethendexternalnumber_of_float:float->numbert="caml_js_from_float"externalfloat_of_number:numbert->float="caml_js_to_float"classtypedate=objectmethodtoString:js_stringtmethmethodtoDateString:js_stringtmethmethodtoTimeString:js_stringtmethmethodtoLocaleString:js_stringtmethmethodtoLocaleDateString:js_stringtmethmethodtoLocaleTimeString:js_stringtmethmethodvalueOf:floatmethmethodgetTime:floatmethmethodgetFullYear:intmethmethodgetUTCFullYear:intmethmethodgetMonth:intmethmethodgetUTCMonth:intmethmethodgetDate:intmethmethodgetUTCDate:intmethmethodgetDay:intmethmethodgetUTCDay:intmethmethodgetHours:intmethmethodgetUTCHours:intmethmethodgetMinutes:intmethmethodgetUTCMinutes:intmethmethodgetSeconds:intmethmethodgetUTCSeconds:intmethmethodgetMilliseconds:intmethmethodgetUTCMilliseconds:intmethmethodgetTimezoneOffset:intmethmethodsetTime:float->floatmethmethodsetFullYear:int->floatmethmethodsetUTCFullYear:int->floatmethmethodsetMonth:int->floatmethmethodsetUTCMonth:int->floatmethmethodsetDate:int->floatmethmethodsetUTCDate:int->floatmethmethodsetDay:int->floatmethmethodsetUTCDay:int->floatmethmethodsetHours:int->floatmethmethodsetUTCHours:int->floatmethmethodsetMinutes:int->floatmethmethodsetUTCMinutes:int->floatmethmethodsetSeconds:int->floatmethmethodsetUTCSeconds:int->floatmethmethodsetMilliseconds:int->floatmethmethodsetUTCMilliseconds:int->floatmethmethodtoUTCString:js_stringtmethmethodtoISOString:js_stringtmethmethodtoJSON:'a->js_stringtmethendclasstypedate_constr=objectmethodparse:js_stringt->floatmethmethod_UTC_month:int->int->floatmethmethod_UTC_day:int->int->floatmethmethod_UTC_hour:int->int->int->int->floatmethmethod_UTC_min:int->int->int->int->int->floatmethmethod_UTC_sec:int->int->int->int->int->int->floatmethmethod_UTC_ms:int->int->int->int->int->int->int->floatmethmethodnow:floatmethendletdate_constr=Unsafe.global##._Dateletdate:date_constrt=date_constrletdate_now:datetconstr=date_constrletdate_fromTimeValue:(float->datet)constr=date_constrletdate_month:(int->int->datet)constr=date_constrletdate_day:(int->int->int->datet)constr=date_constrletdate_hour:(int->int->int->int->datet)constr=date_constrletdate_min:(int->int->int->int->int->datet)constr=date_constrletdate_sec:(int->int->int->int->int->int->datet)constr=date_constrletdate_ms:(int->int->int->int->int->int->int->datet)constr=date_constrclasstypemath=objectmethod_E:floatreadonly_propmethod_LN2:floatreadonly_propmethod_LN10:floatreadonly_propmethod_LOG2E:floatreadonly_propmethod_LOG10E:floatreadonly_propmethod_PI:floatreadonly_propmethod_SQRT1_2_:floatreadonly_propmethod_SQRT2:floatreadonly_propmethodabs:float->floatmethmethodacos:float->floatmethmethodasin:float->floatmethmethodatan:float->floatmethmethodatan2:float->float->floatmethmethodceil:float->floatmethmethodcos:float->floatmethmethodexp:float->floatmethmethodfloor:float->floatmethmethodlog:float->floatmethmethodmax:float->float->floatmethmethodmax_3:float->float->float->floatmethmethodmax_4:float->float->float->float->floatmethmethodmin:float->float->floatmethmethodmin_3:float->float->float->floatmethmethodmin_4:float->float->float->float->floatmethmethodpow:float->float->floatmethmethodrandom:floatmethmethodround:float->floatmethmethodsin:float->floatmethmethodsqrt:float->floatmethmethodtan:float->floatmethendletmath=Unsafe.global##._Mathclasstypeerror=objectmethodname:js_stringtpropmethodmessage:js_stringtpropmethodstack:js_stringtoptdefpropmethodtoString:js_stringtmethendexceptionErroroferrortleterror_constr=Unsafe.global##._Errorlet_=Callback.register_exception"jsError"(Error(Unsafe.obj[||]))letraise_js_error:errort->'a=Unsafe.js_expr"(function (exn) { throw exn })"classtypejson=objectmethodparse:js_stringt->'amethmethodstringify:'a->js_stringtmethendlet_JSON:jsont=Unsafe.global##._JSONletdecodeURI(s:js_stringt):js_stringt=Unsafe.fun_callUnsafe.global##.decodeURI[|Unsafe.injects|]letdecodeURIComponent(s:js_stringt):js_stringt=Unsafe.fun_callUnsafe.global##.decodeURIComponent[|Unsafe.injects|]letencodeURI(s:js_stringt):js_stringt=Unsafe.fun_callUnsafe.global##.encodeURI[|Unsafe.injects|]letencodeURIComponent(s:js_stringt):js_stringt=Unsafe.fun_callUnsafe.global##.encodeURIComponent[|Unsafe.injects|]letescape(s:js_stringt):js_stringt=Unsafe.fun_callUnsafe.global##.escape[|Unsafe.injects|]letunescape(s:js_stringt):js_stringt=Unsafe.fun_callUnsafe.global##.unescape[|Unsafe.injects|]externalbool:bool->boolt="caml_js_from_bool"externalto_bool:boolt->bool="caml_js_to_bool"externalstring:string->js_stringt="caml_js_from_string"externalto_string:js_stringt->string="caml_js_to_string"externalarray:'aarray->'ajs_arrayt="caml_js_from_array"externalto_array:'ajs_arrayt->'aarray="caml_js_to_array"externalbytestring:string->js_stringt="caml_jsbytes_of_string"externalto_bytestring:js_stringt->string="caml_js_to_byte_string"externaltypeof:_t->js_stringt="caml_js_typeof"externalinstanceof:_t->_constr->bool="caml_js_instanceof"letisNaN(i:'a):bool=to_bool(Unsafe.fun_callUnsafe.global##.isNaN[|Unsafe.injecti|])letparseInt(s:js_stringt):int=lets=Unsafe.fun_callUnsafe.global##.parseInt[|Unsafe.injects|]inifisNaNsthenfailwith"parseInt"elsesletparseFloat(s:js_stringt):float=lets=Unsafe.fun_callUnsafe.global##.parseFloat[|Unsafe.injects|]inifisNaNsthenfailwith"parseFloat"elseslet_=Printexc.register_printer(function|Errore->Some(to_stringe##toString)|_->None)let_=Printexc.register_printer(fune->lete:<..>t=Obj.magiceinifinstanceofearray_constructorthenNoneelseSome(to_stringe##toString))letstring_of_errore=to_stringe##toStringexternalget_export_var:unit-><..>t="caml_js_export_var"letexport_js(field:js_stringt)x=Unsafe.set(get_export_var())fieldxletexportfieldx=export_js(stringfield)xletexport_allobj=letkeys=object_keysobjinkeys##forEach(wrap_callback(fun(key:js_stringt)__->export_jskey(Unsafe.getobjkey)))(****)(* DEPRECATED *)typefloat_prop=floatpropexternalfloat:float->float="%identity"externalto_float:float->float="%identity"