Module Js

module Js: sig .. end
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
type boolean 
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
type (+'a, +'e) promise 
Deprecated. please use Js.Promise
The promise type, defined here for interoperation across packages
val true_ : boolean
val false_ : boolean
val null : 'a null
The same as empty in Js.Null will be compiled as null
val undefined : 'a undefined
The same as empty Js.Undefined will be compiled as undefined
val to_bool : boolean -> bool
convert Js boolean to OCaml bool
val typeof : 'a -> string
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
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
module Null: Js_null
Provide utilities arond 'a null
module Undefined: Js_undefined
Provide utilities around Js.undefined
module Null_undefined: Js_null_undefined
Provide utilities arond Js.null_undefined
module Exn: Js_exn
Provide utilities for dealing with Js exceptions
module Array: Js_array
Provide bindings to Js array
module String: Js_string
Provide bindings to JS string
module Boolean: Js_boolean
Provide utilties for Js.boolean
module Re: Js_re
Provide bindings to Js regex expression
module Promise: Js_promise
Provide bindings to JS promise
module Date: Js_date
Provide bindings for JS Date
module Dict: Js_dict
Provide utilities for JS dictionary object
module Global: Js_global
Provide bindings to JS global functions in global namespace
module Json: Js_json
Provide utilities for json
module Math: Js_math
Provide bindings for JS Math object
module Obj: Js_obj
Provide utilities for Js.t
module Typed_array: Js_typed_array
Provide bindings for JS typed array
module Types: Js_types
Provide utilities for maninpulatig JS types
module Float: Js_float
Provide utilities for JS float
module Int: Js_int
Provide utilities for int
module Option: Js_option
Provide utilities for option
module Result: Js_result
definie the interface for result
module List: Js_list
Provide utilties for list
module Vector: Js_vector