1
1
package io .scalajs .nodejs .tty
2
2
3
+ import com .thoughtworks .enableIf
3
4
import io .scalajs .nodejs .FileDescriptor
4
- import io .scalajs .nodejs .net . Socket
5
+ import io .scalajs .nodejs .net
5
6
6
7
import scala .scalajs .js
7
8
import scala .scalajs .js .annotation .JSImport
@@ -15,11 +16,7 @@ import scala.scalajs.js.annotation.JSImport
15
16
*/
16
17
@ js.native
17
18
@ JSImport (" tty" , " WriteStream" )
18
- class WriteStream (fd : FileDescriptor ) extends Socket {
19
-
20
- // ///////////////////////////////////////////////////////////////////////////////
21
- // Properties
22
- // ///////////////////////////////////////////////////////////////////////////////
19
+ class WriteStream (fd : FileDescriptor ) extends net.Socket {
23
20
24
21
/**
25
22
* A number specifying the number of columns the TTY currently has. This property is updated whenever
@@ -29,6 +26,31 @@ class WriteStream(fd: FileDescriptor) extends Socket {
29
26
*/
30
27
def columns : Int = js.native
31
28
29
+ @ enableIf(io.scalajs.nodejs.CompilerSwitches .gteNodeJs12)
30
+ def clearLine (dir : Int , callback : js.Function ): Boolean = js.native
31
+ // TODO: Return value should be boolean when dropping Node.js v10
32
+ def clearLine (dir : Int ): Unit = js.native
33
+
34
+ @ enableIf(io.scalajs.nodejs.CompilerSwitches .gteNodeJs12)
35
+ def clearScreenDown (callback : js.Function ): Boolean = js.native
36
+ // TODO: Return value should be boolean when dropping Node.js v10
37
+ def clearScreenDown (): Unit = js.native
38
+
39
+ // TODO: Return value should be boolean when dropping Node.js v10
40
+ def cursorTo (x : Int ): Unit = js.native
41
+ // TODO: Return value should be boolean when dropping Node.js v10
42
+ def cursorTo (x : Int , y : Int ): Unit = js.native
43
+ @ enableIf(io.scalajs.nodejs.CompilerSwitches .gteNodeJs12)
44
+ def cursorTo (x : Int , y : Int , callback : js.Function ): Boolean = js.native
45
+
46
+ @ enableIf(io.scalajs.nodejs.CompilerSwitches .gteNodeJs10)
47
+ def getColorDepth (env : io.scalajs.nodejs.process.Environment = js.native): Int = js.native
48
+
49
+ def getWindowSize (): js.Tuple2 [Int , Int ] = js.native
50
+
51
+ @ enableIf(io.scalajs.nodejs.CompilerSwitches .gteNodeJs12)
52
+ def hasColors (count : Int = js.native, env : io.scalajs.nodejs.process.Environment = js.native): Boolean = js.native
53
+
32
54
/**
33
55
* Indicates whether the stream is a TTY
34
56
*/
@@ -42,4 +64,9 @@ class WriteStream(fd: FileDescriptor) extends Socket {
42
64
*/
43
65
def rows : Int = js.native
44
66
67
+ // TODO: Return value should be boolean when dropping Node.js v10
68
+ def moveCursor (dx : Int , dy : Int ): Unit = js.native
69
+ @ enableIf(io.scalajs.nodejs.CompilerSwitches .gteNodeJs12)
70
+ def moveCursor (dx : Int , dy : Int , callback : js.Function ): Boolean = js.native
71
+
45
72
}
0 commit comments