package vue-jsoo
Install
Dune Dependency
Authors
Maintainers
Sources
md5=ba1262b631818c3d20eb872b0f6989de
sha512=d326ec29baa9abd5ad0629e3d854b78cb6846714d73b6517fa1f2341f909fe9b4cfd554c113674e133e23e8906d402ab0a3df4210dca1a775ea04c29486cb1cd
doc/vue-jsoo.mjs/Mjs/index.html
Module Mjs
Source
include module type of struct include Ezjs_min end
include module type of struct include Js_of_ocaml.Js end
Dealing with null
and undefined
values.
Type of possibly null values.
Type of possibly undefined values.
Signatures of a set of standard functions for manipulating optional values.
Standard functions for manipulating possibly null values.
Standard functions for manipulating possibly undefined values.
Types for specifying method and properties of Javascript objects
Type of Javascript objects. The type parameter is used to specify more precisely an object.
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-only properties: a Javascript object <p : t Js.readonly_prop> Js.t
has a read-only property p
of type t
.
Type of write-only properties: a Javascript object <p : t Js.writeonly_prop> Js.t
has a write-only property p
of type t
.
Type of read/write properties: a Javascript object <p : t Js.writeonly_prop> Js.t
has a read/write property p
of type t
.
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
).
Object constructors
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
.
Callbacks to OCaml
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
.
Type of callback functions intended to be called without a meaningful this
implicit parameter.
Wrap an OCaml function so that it can be invoked from Javascript.
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.
Javascript comparisons
Javascript standard objects
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.)
Opaque type for Unicode normalization forms.
Canonical Decomposition
Canonical Decomposition, followed by Canonical Composition
Compatibility Decomposition
Compatibility Decomposition, followed by Canonical Composition
Specification of Javascript number objects.
Specification of the string constructor, considered as an object.
The string constructor, as an object.
Constructor of RegExp
objects. The expression new%js regExp s
builds the regular expression specified by string s
.
Constructor of RegExp
objects. The expression new%js regExp s f
builds the regular expression specified by string s
using flags f
.
Constructor of RegExp
objects. The expression new%js regExp r
builds a copy of regular expression r
.
Specification of Javascript regular arrays. Use Js.array_get
and Js.array_set
to access and set array elements.
Returns jsarray containing keys of the object as Object.keys does.
Constructor of Array
objects. The expression new%js array_empty
returns an empty array.
Constructor of Array
objects. The expression new%js array_length l
returns an array of length l
.
Array access: array_get a i
returns the element at index i
of array a
. Returns undefined
if there is no element at this index.
Array update: array_set a i v
puts v
at index i
in array a
.
Array map: array_map f a
is a##map(wrap_callback (fun elt idx arr -> f elt))
.
Array mapi: array_mapi f a
is a##map(wrap_callback (fun elt idx arr -> f idx elt))
.
Specification of match result objects
Convert an opaque string_array t
object into an array of string. (Used to resolved the mutual dependency between string and array type definitions.)
Convert a match result handle into a MatchResult
object. (Used to resolved the mutual dependency between string and array type definitions.)
Constructor of Date
objects: new%js date_now
returns a Date
object initialized with the current date.
Constructor of Date
objects: new%js date_fromTimeValue t
returns a Date
object initialized with the time value t
.
Constructor of Date
objects: new%js date_fromTimeValue y m
returns a Date
object corresponding to year y
and month m
.
Constructor of Date
objects: new%js date_fromTimeValue y m d
returns a Date
object corresponding to year y
, month m
and day d
.
Constructor of Date
objects: new%js date_fromTimeValue y m d h
returns a Date
object corresponding to year y
to hour h
.
Constructor of Date
objects: new%js date_fromTimeValue y m d h m'
returns a Date
object corresponding to year y
to minute m'
.
Constructor of Date
objects: new%js date_fromTimeValue y m d h m' s
returns a Date
object corresponding to year y
to second s
.
Constructor of Date
objects: new%js date_fromTimeValue y m d h m' s ms
returns a Date
object corresponding to year y
to millisecond ms
.
Specification of the date constructor, considered as an object.
The date constructor, as an object.
Constructor of Error
objects: new%js error_constr msg
returns an Error
object with the message msg
.
Standard Javascript functions
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.
Decode a URIComponent: replace all escape sequences by the corresponding byte and convert the string from UTF-8 to UTF-16.
Encode a URI: convert the string to UTF-8 and replace all unsafe bytes by the corresponding escape sequence.
Same as encodeURI
, but also encode URI reserved characters.
Escape a string: unsafe UTF-16 code points are replaced by 2-digit and 4-digit escape sequences.
Unescape a string: 2-digit and 4-digit escape sequences are replaced by the corresponding UTF-16 code point.
Conversion functions between Javascript and OCaml types
Conversion of strings from OCaml to Javascript. (The OCaml string is considered to be encoded in UTF-8 and is converted to UTF-16.)
Conversion of strings of bytes from OCaml to Javascript. (Each byte will be converted in an UTF-16 code point.)
Conversion of strings of bytes from Javascript to OCaml. (The Javascript string should only contain UTF-16 code points below 255.)
Conversion of OCaml floats to Javascript number objects.
Conversion of Javascript number objects to OCaml floats.
Conversion of Javascript numbers to OCaml 32-bits. The given floating-point number is truncated to an integer.
Conversion of OCaml 32-bits integers to Javascript numbers.
Conversion of Javascript numbers to OCaml native integers. The given floating-point number is truncated to an integer.
Convenience coercion functions
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:
Js.coerce_opt (Dom_html.document##getElementById id)
Dom_html.CoerceTo.div (fun _ -> assert false)
Type checking operators.
Tests whether a Javascript object is an instance of a given class.
Debugging operations.
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.
export name value
export name
export_all obj
export every key of obj
object.
export_all
object%js
method add x y = x +. y
method abs x = abs_float x
val zero = 0.
end
Unsafe operations.
Unsafe Javascript operations
Deprecated functions and types.
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
.
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.
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.
Type of float properties.