Type used to specify method types: a Javascript object <m : t1 -> t2 -> ... -> tn -> t Js.meth> Js.t has a Javascript method m expecting n arguments of types t1 to tn and returns a value of type t.
Type used to specify the properties of Javascript objects. In practice you should rarely need this type directly, but should rather use the type abbreviations below instead.
Type of read/write properties that may be undefined: you can set them to a value of some type t, but if you read them, you will get a value of type t optdef (that may be undefined).
A value of type (t1 -> ... -> tn -> t Js.t) Js.constr is a Javascript constructor expecting n arguments of types t1 to tn and returning a Javascript object of type t Js.t. Use the syntax extension new%js c (e1, ..., en) to build an object using constructor c and arguments e1 to en.
Type of callback functions. A function of type (u, t1 -> ... -> tn -> t) meth_callback can be called from Javascript with this bound to a value of type u and up to n arguments of types t1 to tn. The system takes care of currification, so less than n arguments can be provided. As a special case, a callback of type (t, unit -> t) meth_callback can be called from Javascript with no argument. It will behave as if it was called with a single argument of type unit.
Wrap 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 this implicit parameter.
A handle to a match result. Use function Js.match_result to get the corresponding MatchResult object. (This type is used to resolved the mutual dependency between string and array type definitions.)
Opaque type for string arrays. You can get the actual Array object using function Js.str_array. (This type is used to resolved the mutual dependency between string and array type definitions.)
Decode a URI: replace by the corresponding byte all escape sequences but the ones corresponding to a URI reserved character and convert the string from UTF-8 to UTF-16.
Apply a possibly failing coercion function. coerce_opt v c f attempts to apply coercion c to value v. If v is null or the coercion returns null, function f is called. Typical usage is the following:
Invokes any available debugging functionality. If no debugging functionality is available, it has no effect. In practice, it will insert a "debugger;" statement in the generated javascript.
Export functionality.
Export values to module.exports if it exists or to the global object otherwise.
Attach a JavasScript error to an OCaml exception. if force = false and a JavasScript error is already attached, it will do nothing. This function is useful to store and retrieve information about JavaScript stack traces.
Attaching JavasScript errors will happen automatically when compiling with --enable with-js-error.
deprecated [since 4.0] Use [Js_error.raise_] instead.
Extract a JavaScript error attached to an OCaml exception, if any. This is useful to inspect an eventual stack strace, especially when sourcemap is enabled.
deprecated [since 4.0] Use [Js_error.of_exn] instead.
The Error exception wrap javascript exceptions when caught by OCaml code. In case the javascript exception is not an instance of javascript Error, it will be serialized and wrapped into a Failure exception.
deprecated [since 4.0] Use [Js_error.Exn] instead.