@@ -3,7 +3,7 @@ package io.scalajs.nodejs
33import io .scalajs .nodejs .stream .Writable
44
55import scala .scalajs .js
6- import scala .scalajs .js .annotation .{ JSImport , ScalaJSDefined }
6+ import scala .scalajs .js .annotation .JSImport
77
88/**
99 * The console module provides a simple debugging console that is similar to the JavaScript console mechanism
@@ -16,7 +16,7 @@ import scala.scalajs.js.annotation.{JSImport, ScalaJSDefined}
1616 * <li>A global console instance configured to write to stdout and stderr. Because this object is global, it can be
1717 * used without calling require('console').</li>
1818 * </ul>
19- * @see https://nodejs.org/api/console.html
19+ * @see https://nodejs.org/dist/latest-v8.x/docs/ api/console.html
2020 * @author lawrence.daniels@gmail.com
2121 */
2222@ js.native
@@ -37,6 +37,28 @@ class Console(stdout: Writable, stderr: Writable = js.native) extends js.Object
3737 */
3838 def assert (value : js.Any , args : Any * ): Unit = js.native
3939
40+ /**
41+ * When stdout is a TTY, calling console.clear() will attempt to clear the TTY. When stdout is not a TTY,
42+ * this method does nothing.
43+ *
44+ * Note: The specific operation of console.clear() can vary across operating systems and terminal types.
45+ * For most Linux operating systems, console.clear() operates similarly to the clear shell command.
46+ * On Windows, console.clear() will clear only the output in the current terminal viewport for the Node.js binary.
47+ */
48+ def clear (): Unit = js.native
49+
50+ /**
51+ * Maintains an internal counter specific to label and outputs to stdout the number of times console.count() has been called with the given label.
52+ * @param label the display label for the counter. Defaults to 'default'.
53+ */
54+ def count (label : String = js.native): Unit = js.native
55+
56+ /**
57+ * Resets the internal counter specific to label.
58+ * @param label the display label for the counter. Defaults to 'default'.
59+ */
60+ def countReset (label : String = js.native): Unit = js.native
61+
4062 /**
4163 * Uses util.inspect() on obj and prints the resulting string to stdout.
4264 * This function bypasses any custom inspect() function defined on obj
@@ -59,6 +81,23 @@ class Console(stdout: Writable, stderr: Writable = js.native) extends js.Object
5981 */
6082 def error (data : js.Any , args : Any * ): Unit = js.native
6183
84+ /**
85+ * Increases indentation of subsequent lines by two spaces.
86+ * If one or more labels are provided, those are printed first without the additional indentation.
87+ * @param label the labels
88+ */
89+ def group (label : js.Any * ): Unit = js.native
90+
91+ /**
92+ * An alias for console.group().
93+ */
94+ def groupCollapsed (): Unit = js.native
95+
96+ /**
97+ * Decreases indentation of subsequent lines by two spaces.
98+ */
99+ def groupEnd (): Unit = js.native
100+
62101 /**
63102 * The console.info() function is an alias for console.log().
64103 * @example console.info([data][, ...])
@@ -113,6 +152,7 @@ class Console(stdout: Writable, stderr: Writable = js.native) extends js.Object
113152 * see customizing util.inspect() colors.
114153 * @author lawrence.daniels@gmail.com
115154 */
116- @ ScalaJSDefined
117- class ConsoleDirOptions (var showHidden : Boolean = false , var depth : Integer = 2 , var colors : Boolean = false )
155+ class ConsoleDirOptions (var showHidden : js.UndefOr [Boolean ] = js.undefined,
156+ var depth : js.UndefOr [Int ] = js.undefined,
157+ var colors : js.UndefOr [Boolean ] = js.undefined)
118158 extends js.Object
0 commit comments