Console
Functions for interacting with JavaScript console.
See: console.
assert_
let assert_: (bool, 'a) => unitassert_(assertion, value) print a message to console if assertion evaluates false. Does nothing if it's true.
See console.assert
on MDN.
Examples
RESCRIPTConsole.assert_(false, "Hello World!")
Console.assert_(42 == 42, "The answer")
assert2
let assert2: (bool, 'a, 'b) => unitassert2(v1, v2). Like assert_, but with two arguments.
Examples
RESCRIPTConsole.assert2(false, "Hello", "World")
Console.assert2(42 == 42, [1, 2, 3], '4')
assert3
let assert3: (bool, 'a, 'b, 'c) => unitassert3(v1, v2, v3). Like assert_, but with three arguments.
Examples
RESCRIPTConsole.assert3(false, "Hello", "World", "ReScript")
Console.assert3(42 == 42, "One", 2, #3)
assert4
let assert4: (bool, 'a, 'b, 'c, 'd) => unitassert4(v1, v2, v3, v4). Like assert_, but with four arguments.
Examples
RESCRIPTlet value = 42
Console.assert4(false, "Hello", "World", "ReScript", "!!!")
Console.assert4(value == 42, [1, 2], (3, 4), [#5, #6], #"polyvar")
assert5
let assert5: (bool, 'a, 'b, 'c, 'd, 'e) => unitassert5(v1, v2, v3, v4, v5). Like assert_, but with five arguments.
Examples
RESCRIPTlet value = 42
Console.assert5(false, "Hello", "World", "JS", '!', '!')
Console.assert5(value == 42, [1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"})
assert6
let assert6: (bool, 'a, 'b, 'c, 'd, 'e, 'f) => unitassert6(v1, v2). Like assert_, but with six arguments.
Examples
RESCRIPTlet value = 42
Console.assert6(false, "Hello", "World", "JS", '!', '!', '?')
Console.assert6(value == 42, [1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}, 42)
assertMany
let assertMany: (bool, array<'a>) => unitassertMany(assertion, arr). Like assert_, but variadic.
Examples
RESCRIPTlet value = 42
Console.assertMany(false, ["Hello", "World"])
Console.assertMany(value == 42, [1, 2, 3])
clear
let clear: unit => unitcount
let count: string => unitcount(label) prints to the console the number of times it's been called with the given label.
See console.count
on MDN.
Examples
RESCRIPTConsole.count("rescript")
countReset
let countReset: string => unitcountReset(label) resets the count for the given label to 0.
See console.countReset
on MDN.
Examples
RESCRIPTConsole.countReset("rescript")
debug
let debug: 'a => unitdebug(value) print a debug message to console.
See console.debug
on MDN.
Examples
RESCRIPTConsole.debug("Hello")
let obj = {"name": "ReScript", "version": 10}
Console.debug(obj)
debug2
let debug2: ('a, 'b) => unitdebug2(v1, v2). Like debug, but with two arguments.
Examples
RESCRIPTConsole.debug2("Hello", "World")
Console.debug2([1, 2, 3], '4')
debug3
let debug3: ('a, 'b, 'c) => unitdebug3(v1, v2, v3). Like debug, but with three arguments.
Examples
RESCRIPTConsole.debug3("Hello", "World", "ReScript")
Console.debug3("One", 2, #3)
debug4
let debug4: ('a, 'b, 'c, 'd) => unitdebug4(v1, v2, v3, v4). Like debug, but with four arguments.
Examples
RESCRIPTConsole.debug4("Hello", "World", "ReScript", "!!!")
Console.debug4([1, 2], (3, 4), [#5, #6], #"polyvar")
debug5
let debug5: ('a, 'b, 'c, 'd, 'e) => unitdebug5(v1, v2, v3, v4, v5). Like debug, but with five arguments.
Examples
RESCRIPTConsole.debug5("Hello", "World", "JS", '!', '!')
Console.debug5([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"})
debug6
let debug6: ('a, 'b, 'c, 'd, 'e, 'f) => unitdebug6(v1, v2, v3, v4, v5, v6). Like debug, but with six arguments.
Examples
RESCRIPTConsole.debug6("Hello", "World", "JS", '!', '!', '?')
Console.debug6([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}, 42)
debugMany
let debugMany: array<'a> => unitdebugMany(arr). Like debug, but variadic.
Examples
RESCRIPTConsole.debugMany(["Hello", "World"])
Console.debugMany([1, 2, 3])
dir
let dir: 'a => unitdir(object) displays an interactive view of the object in the console.
See console.dir
on MDN.
Examples
RESCRIPTConsole.dir({"language": "rescript", "version": "10.1.2"})
dirxml
let dirxml: 'a => unitdirxml(object) displays an interactive tree view of an XML/HTML element in the console.
See console.dirxml
on MDN.
error
let error: 'a => uniterror(value) prints an error message to console.
See console.error
on MDN.
Examples
RESCRIPTConsole.error("error message")
Console.error(("error", "invalid value"))
error2
let error2: ('a, 'b) => uniterror(v1, v2). Like error, but two arguments.
Examples
RESCRIPTConsole.error2("Error", "here")
Console.error2(("log", "error"), "message")
error3
let error3: ('a, 'b, 'c) => uniterror3(v1, v2, v3). Like error, but three arguments.
Examples
RESCRIPTConsole.error3("Hello", "World", "!!!")
Console.error3(#first, #second, #third)
error4
let error4: ('a, 'b, 'c, 'd) => uniterror4(v1, v2, v3, v4). Like error, but with four arguments.
Examples
RESCRIPTConsole.error4("Hello", "World", "ReScript", '!')
Console.error4(#first, #second, #third, ("fourth"))
error5
let error5: ('a, 'b, 'c, 'd, 'e) => uniterror5(v1, v2, v3, v4, v5). Like error, but with five arguments.
Examples
RESCRIPTConsole.error5('e', 'r', 'r', 'o', 'r')
Console.error5(1, #second, #third, ("fourth"), 'c')
error6
let error6: ('a, 'b, 'c, 'd, 'e, 'f) => uniterror6(v1, v2, v3, v4, v5, v6). Like error, but with six arguments.
Examples
RESCRIPTConsole.error6("Hello", "World", "from", "JS", "!!!", '!')
Console.error6([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}, 42)
group
let group: string => unitgroup(label) creates a new "group" level with the given label.
See console.group
on MDN.
Example
RESCRIPTConsole.group("first group")
Console.group("second group")
Console.log("a message on the second level")
Console.groupEnd()
Console.log("a message message on the first level")
Console.groupEnd()
groupCollapsed
let groupCollapsed: string => unitgroupCollapsed(label). Like group but collapses the group initially.
See console.groupCollapsed
on MDN.
groupEnd
let groupEnd: unit => unitgroupEnd() ends the current group.
See console.groupEnd
on MDN.
errorMany
let errorMany: array<'a> => uniterrorMany(arr). Like error, but variadic.
Examples
RESCRIPTConsole.errorMany(["Hello", "World"])
Console.errorMany([1, 2, 3])
info
let info: 'a => unitinfo(value) print an informational message to console.
See console.info
on MDN.
Examples
RESCRIPTConsole.info("Information")
Console.info(("Hello", "JS"))
info2
let info2: ('a, 'b) => unitinfo2(v1, v2). Like info, but with two arguments.
Examples
RESCRIPTConsole.info2("Info", "failed to download")
Console.info2(#info, {"name": "ReScript"})
info3
let info3: ('a, 'b, 'c) => unitinfo3(v1, v2, v3). Like info, but with three arguments.
Examples
RESCRIPTConsole.info3("Hello", "World", "ReScript")
Console.info3([1, 2, 3], #4, #5)
info4
let info4: ('a, 'b, 'c, 'd) => unitinfo4(v1, v2, v3, v4). Like info, but with four arguments.
Examples
RESCRIPTConsole.info4("Hello", "World", "ReScript", '!')
Console.info4([1, 2, 3], #4, #5, #lastinfo)
info5
let info5: ('a, 'b, 'c, 'd, 'e) => unitinfo5(v1, v2, v3, v4, v5). Like info, but with five arguments.
Examples
RESCRIPTConsole.info5("Hello", "World", "from", "JS", "!!!")
Console.info5([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"})
info6
let info6: ('a, 'b, 'c, 'd, 'e, 'f) => unitinfo6(v1, v2, v3, v4, v5, v6). Like info, but with six arguments.
Examples
RESCRIPTConsole.info6("Hello", "World", "from", "JS", "!!!", '!')
Console.info6([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}, 42)
infoMany
let infoMany: array<'a> => unitinfoMany(arr). Like info, but variadic.
Examples
RESCRIPTConsole.infoMany(["Hello", "World"])
Console.infoMany([1, 2, 3])
log
let log: 'a => unitlog(value) print a message to console.
See console.log
on MDN.
Examples
RESCRIPTConsole.log("Hello")
let obj = {"name": "ReScript", "version": 10}
Console.log(obj)
log2
let log2: ('a, 'b) => unitlog2(v1, v2). Like log, but with two arguments.
Examples
RESCRIPTConsole.log2("Hello", "World")
Console.log2([1, 2, 3], '4')
log3
let log3: ('a, 'b, 'c) => unitlog3(v1, v2, v3). Like log, but with three arguments.
Examples
RESCRIPTConsole.log3("Hello", "World", "ReScript")
Console.log3("One", 2, #3)
log4
let log4: ('a, 'b, 'c, 'd) => unitlog4(v1, v2, v3, v4). Like log, but with four arguments.
Examples
RESCRIPTConsole.log4("Hello", "World", "ReScript", "!!!")
Console.log4([1, 2], (3, 4), [#5, #6], #"polyvar")
log5
let log5: ('a, 'b, 'c, 'd, 'e) => unitlog5(v1, v2, v3, v4, v5). Like log, but with five arguments.
Examples
RESCRIPTConsole.log5("Hello", "World", "JS", '!', '!')
Console.log5([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"})
log6
let log6: ('a, 'b, 'c, 'd, 'e, 'f) => unitlog6(v1, v2, v3, v4, v5, v6). Like log, but with six arguments.
Examples
RESCRIPTConsole.log6("Hello", "World", "JS", '!', '!', '?')
Console.log6([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}, 42)
logMany
let logMany: array<'a> => unitlogMany(arr). Like log, but variadic.
Examples
RESCRIPTConsole.logMany(["Hello", "World"])
Console.logMany([1, 2, 3])
table
let table: 'a => unittable(object) displays an tabular view of the object in the console.
See console.table
on MDN.
Examples
RESCRIPTConsole.table({"language": "rescript", "version": "10.1.2"})
time
let time: string => unittime(label) creates a timer to measure how long an operation takes. label
must be a unique name. Call console.timeEnd with the same label to print
output time.
See console.time
on MDN.
Examples
RESCRIPTConsole.time("for_time")
for x in 3 downto 1 {
Console.log(x)
Console.timeLog("for_time")
}
Console.timeEnd("for_time")
timeEnd
let timeEnd: string => unittimeEnd(label) stops a timer created by time.
See console.timeEnd
on MDN.
Examples
RESCRIPTConsole.time("for_time")
for x in 3 downto 1 {
Console.log(x)
Console.timeLog("for_time")
}
Console.timeEnd("for_time")
timeLog
let timeLog: string => unittimeLog(label) prints the current elapsed time of the given timer to the console.
See console.timeLog
on MDN.
Examples
RESCRIPTConsole.time("for_time")
for x in 3 downto 1 {
Console.log(x)
Console.timeLog("for_time")
}
Console.timeEnd("for_time")
trace
let trace: unit => unittrace() print a stack trace to console.
See console.trace
on MDN.
Examples
RESCRIPTlet main = () => {
Console.trace()
}
main()
// In the console, the following trace will be displayed:
// main
// <anonymous>
warn
let warn: 'a => unitwarn(value) print a warning message to console.
See console.warn
on MDN.
Examples
RESCRIPTConsole.warn("Warning")
Console.warn(("Warning", "invalid number"))
warn2
let warn2: ('a, 'b) => unitwarn2(v1, v2). Like warn, but two arguments.
Examples
RESCRIPTConsole.warn2("Hello", "World")
Console.warn2([1, 2, 3], 4)
warn3
let warn3: ('a, 'b, 'c) => unitwarn3(v1, v2, v3). Like warn, but three arguments.
Examples
RESCRIPTConsole.warn3("Hello", "World", "ReScript")
Console.warn3([1, 2, 3], #4, #5)
warn4
let warn4: ('a, 'b, 'c, 'd) => unitwarn4(v1, v2, v3, v4). Like warn, but with four arguments.
Examples
RESCRIPTConsole.warn4("Hello", "World", "ReScript", "!!!")
Console.warn4(#first, #second, #third, ("fourth"))
warn5
let warn5: ('a, 'b, 'c, 'd, 'e) => unitwarn5(v1, v2, v3, v4, v5). Like warn, but with five arguments.
Examples
RESCRIPTConsole.warn5("Hello", "World", "from", "JS", "!!!")
Console.warn5([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"})
warn6
let warn6: ('a, 'b, 'c, 'd, 'e, 'f) => unitwarn6(v1, v2, v3, v4, v5, v6). Like warn, but with six arguments.
Examples
RESCRIPTConsole.warn6("Hello", "World", "from", "JS", "!!!", '!')
Console.warn6([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}, 42)
warnMany
let warnMany: array<'a> => unit