Module Js.Unsafe
Unsafe Javascript operations
type any_js_array= any
val inject : 'a -> anyCoercion to top type.
val get : 'a -> 'b -> 'cGet the value of an object property. The expression
get o sreturns the value of propertysof objecto.
val set : 'a -> 'b -> 'c -> unitSet an object property. The expression
set o s vset the propertysof objectoto valuev.
val delete : 'a -> 'b -> unitDelete an object property. The expression
delete o sdeletes propertysof objecto.
val call : 'a -> 'b -> any array -> 'cPerforms a Javascript function call. The expression
call f o acalls the Javascript functionfwith the arguments given by the arraya, and bindingthistoo.
val fun_call : 'a -> any array -> 'bPerforms a Javascript function call. The expression
fun_call f acalls the Javascript functionfwith the arguments given by the arraya.
val meth_call : 'a -> string -> any array -> 'bPerforms a Javascript method call. The expression
meth_call o m acalls the Javascript methodmof objectowith the arguments given by the arraya.
val new_obj : 'a -> any array -> 'bCreate a Javascript object. The expression
new_obj c acreates a Javascript object with constructorcusing the arguments given by the arraya. Example:Js.new_obj (Js.Unsafe.variable "ArrayBuffer") [||]
val new_obj_arr : 'a -> any_js_array -> 'bSame Create a Javascript object. The expression
new_obj_arr c acreates a Javascript object with constructorcusing the arguments given by the Javascript arraya.
val obj : (string * any) array -> 'aCreates a Javascript literal object. The expression
obj acreates a Javascript object whose fields are given by the arraya
val pure_expr : (unit -> 'a) -> 'aAsserts that an expression is pure, and can therefore be optimized away by the compiler if unused.
val js_expr : string -> 'ajs_expr ewill parse the JavaScript expressioneifeis available at compile time or will fallback to a runtime evaluation. Seeeval_string
val global : < .. > tJavascript global object
val callback : ('a -> 'b) -> ('c, 'a -> 'b) meth_callbackWrap an OCaml function so that it can be invoked from Javascript. Contrary to
Js.wrap_callback, partial application and over-application are not supported: missing arguments will be set toundefinedand extra arguments are lost.
val callback_with_arguments : (any_js_array -> 'b) -> ('c, any_js_array -> 'b) meth_callbackWrap an OCaml function so that it can be invoked from Javascript. The first parameter of the function will be bound to the
argumentsJavaScript
val callback_with_arity : int -> ('a -> 'b) -> ('c, 'a -> 'b) meth_callbackval meth_callback : ('b -> 'a) -> ('b, 'a) meth_callbackWrap an OCaml function so that it can be invoked from Javascript. The first parameter of the function will be bound to the value of the
thisimplicit parameter. Contrary toJs.wrap_meth_callback, partial application and over-application is not supported: missing arguments will be set toundefinedand extra arguments are lost.
val meth_callback_with_arguments : ('b -> any_js_array -> 'a) -> ('b, any_js_array -> 'a) meth_callbackWrap an OCaml function so that it can be invoked from Javascript. The first parameter of the function will be bound to the value of the
thisimplicit parameter. The second parameter of the function with be bound to the value of thearguments.
val meth_callback_with_arity : int -> ('b -> 'a) -> ('b, 'a) meth_callback