This library provides bindings and necessary support for JS FFI.
It contains all bindings into Js namespace.
[| 1;2;3;4|]
|> Js.Array.map (fun x -> x + 1 )
|> Js.Array.reduce (+) 0
|> Js.log
type+'a t
Js object type.
let x : < x : int ; y : int > Js.t =
[%obj{ x = 1 ; y = 2}]
type+'a null
nullable, value of this type can be either null or 'a
this type is the same as type t in Js.Null
type+'a undefined
value of this type can be either undefined or 'a
this type is the same as type t in Js.Undefined
type+'a null_undefined
value of this type can be undefined, null or 'a
this type is the same as type t n Js.Null_undefined
typeboolean
The value could be either Js.true_ or Js.false_.
Note in BuckleScript, boolean has different representation from OCaml's bool,
see conversion functions in Js.Boolean
typeof x will be compiled as typeof x in JS
Please consider functions in Js.Types for a type safe way of reflection
val log : 'a -> unit
typeof x will be compiled as typeof x in JS
val log2 : 'a -> 'b -> unit
val log3 : 'a -> 'b -> 'c -> unit
val log4 : 'a -> 'b -> 'c -> 'd -> unit
A convenience function to log everything
val unsafe_lt : 'a -> 'a -> bool
unsafe_lt a b will be compiled as a < b.
It is marked as unsafe, since it is impossible
to give a proper semantics for comparision which applies to any type
val unsafe_le : 'a -> 'a -> bool
unsafe_le a b will be compiled as a <= b.
See also Js.unsafe_lt
val unsafe_gt : 'a -> 'a -> bool
unsafe_gt a b will be compiled as a > b.
See also Js.unsafe_lt
val unsafe_ge : 'a -> 'a -> bool
unsafe_ge a b will be compiled as a >= b.
See also Js.unsafe_lt