Class Console
¶
The Console, storing the stdin and stdout as well as some functions to control them
Properties¶
Property | Type | Description |
---|---|---|
rawMode | number | The number to set the console to raw mode |
normalMode | number | The number to set the console to normal mode |
onData | function? | The hook that is called when data from stdin is received |
Methods¶
Console.isTTY(tty: tty): boolean¶
Check if the handle is a TTY
Console.new(stdin: tty, stdout: tty): Console¶
Create a new Console
Make sure to call Console.run
to uv.run
in order for the console to operate
If you need stdin and stdout, call util.getHandles()
Console.new(util.getHandles())
Console:setMode(mode: number)¶
Set the mode of the console
Console:write(data: string)¶
Write data to the console
Console:intoMouseMode()¶
Set the console into mouse mode
Console:exitMouseMode()¶
Exit mouse mode
Console:cursorPosition(noClose: boolean): number, number¶
Get the cursor position
This function is asynchronous and must be called from a coroutine
Console:getDimensions(): number, number¶
Get the dimensions of the console
Console:close()¶
Closes the console
Console:_lock(fn: any)¶
Internal function to lock the console
Console:_on(data: any)¶
Internal function that is called when data is received