Constructor
new AnsiTermDriver(params)
This is the base constructor. It is strongly recommended that the constructor of derived classes invokes the base constructor as its first instruction ("super(params)").
Parameters:
Name | Type | Description |
---|---|---|
params |
object | parameters, not used by the base, but stored. |
Classes
Methods
_close()
This is the internal method that closes the communication and releases the resources. Extensions should override it to implement the protocol-specific closing.
_new_data(text)
This method is used by specialized drivers (extensions) to notify the client (i.e., the terminal) that there are new characters to process. If you are thinking of overriding it, think again.
Parameters:
Name | Type | Description |
---|---|---|
text |
string | the new sequence of characters |
_set_connection_state()
This method may be used by extensions to notify a change in the connection state. Never override it.
_set_size(nlines, ncolumns)
This method implements the protocol-specific part of terminal size changle. Extensions can override it to implement the corresponding protocol-specific operation.
Parameters:
Name | Type | Description |
---|---|---|
nlines |
* | Number of lines |
ncolumns |
* | Number of columns |
_start()
This is the internal method that opens the communication. Extensions may override it to implement the protocol-specific connection.
_stop()
This method may be used by extensions to put the base object in a consistent state after an error. Do not override it.
_tx(text)
This method must be overridden by the extension to implement the protocol-specific transmitter. In its base version (defined only for debugging purposes), it sends characters back to the terminal (after some manipulation).
Parameters:
Name | Type | Description |
---|---|---|
text |
string | The sequence of chracters to send |
close()
This method closes the communication and releases the resources.
Never override it, override _close
instread.
getConnectionState() → {boolean}
Used by AnsiTerm to read the current connection state.
Extensions can set the connection state by invoking the _set_connection_state
base method.
It is unlikely that a custom driver will ever need to override this method.
Returns:
The current connection state.
- Type
- boolean
registerOnConnectionChange(on_connection_change)
Used by AnsiTerm to register a notification callback
to be notified of connection state changes.
The callback is invoked when an extension calls the _set_connection_state
base method.
It is unlikely that a custom driver will ever need to override this method.
Parameters:
Name | Type | Description |
---|---|---|
on_connection_change |
function | The callback function |
registerOnDataReceived(on_data_received)
Used by AnsiTerm to register a notification callback
to be notified of new incoming data.
The callback is invoked when an extension calls the _new_data
base method.
It is unlikely that a custom driver will ever need to override this method.
Parameters:
Name | Type | Description |
---|---|---|
on_data_received |
function | The callback function |
send()
This method may be used by the terminal to send data (e.g.,
keyboard events).
Never override it, override _tx
instread.
setSize(nlines, ncolumns)
This method is used by the terminal to set the terminal size.
Never override it, override _set_size
instread.
Parameters:
Name | Type | Description |
---|---|---|
nlines |
* | Number of lines |
ncolumns |
* | Number of columns |
start()
This method opens the communication.
Never override it, override _start
instread.