- tty-events
- Terminal ⏏
- new Terminal(input, output, options)
- instance
- static
- .KeyboardEvent
- .name :
string - .sequence :
string - .isSpecial :
boolean - .ctrl :
boolean - .alt :
boolean - .shift :
boolean - .meta :
boolean - .toString()
- .name :
- .MouseEvent
- .HighlightEvent
- .VT200_MOUSE
- .VT200_HIGHLIGHT_MOUSE
- .BTN_EVENT_MOUSE
- .ANY_EVENT_MOUSE
- .KeyboardEvent
- inner
- Terminal ⏏
Emits terminal-related events.
| Param | Type | Description |
|---|---|---|
| input | ReadableStream |
The input stream. (Normally stdin.) |
| output | WritableStream |
The output stream for activating mouse support and bracketed paste mode. (Normally stdout.) Optional. |
| options | TermOptions |
Removes the data listener from the input stream.
Kind: instance method of Terminal
| Param | Type | Default | Description |
|---|---|---|---|
| pauseStream | boolean |
true |
Whether to pause the input stream. This will allow Node.js to exit. |
Attaches the data listener to the input stream.
Kind: instance method of Terminal
| Param | Type | Default | Description |
|---|---|---|---|
| resumeStream | boolean |
true |
Determines if the underlying input stream is also resumed. |
Enables mouse events.
Kind: instance method of Terminal
| Param | Type | Default | Description |
|---|---|---|---|
| mode | number |
0 |
The mouse mode (one of the constants) |
| sgr | boolean |
true |
Whether to try to activate SGR extended mode |
Disables mouse events.
Kind: instance method of Terminal
Enables bracketed paste mode.
Kind: instance method of Terminal
Disables bracketed paste mode.
Kind: instance method of Terminal
Enables focus events.
Kind: instance method of Terminal
Disables focus events.
Kind: instance method of Terminal
Event fired when a key (or key combination) is pressed.
Kind: event emitted by Terminal
Event fired when a mouse button is pressed down.
Kind: event emitted by Terminal
Event fired when a mouse button is released.
Kind: event emitted by Terminal
Event fired when the cursor moves.
Kind: event emitted by Terminal
Event fired when the mouse wheel is moved or when the scroll action is triggered (for example, using two fingers on a trackpad).
Kind: event emitted by Terminal
Event fired with any mouse event.
Kind: event emitted by Terminal
See: module:tty-events.MouseEvent#type
Event fired when text is pasted while bracketed paste mode is activated.
Kind: event emitted by Terminal
Event fired when the terminal window receives focus.
Kind: event emitted by Terminal
Event fired when the terminal window loses focus.
Kind: event emitted by Terminal
Event fired when text is selected using highlight tracking. This event may not fire if the selection was empty.
Kind: event emitted by Terminal
Event fired when the terminal receives an unrecognized or broken escape sequence.
Kind: event emitted by Terminal
Represents a keyboard event (key or key combination).
Kind: static class of Terminal
- .KeyboardEvent
- .name :
string - .sequence :
string - .isSpecial :
boolean - .ctrl :
boolean - .alt :
boolean - .shift :
boolean - .meta :
boolean - .toString()
- .name :
The key name (for special keys) or character produced by the key.
Kind: instance property of KeyboardEvent
The sequence produced by the key / key combination.
Kind: instance property of KeyboardEvent
Determines if the key is a special key. Special keys have names like f2 or backspace or are a combination of Ctrl+symbol / Ctrl+letter.
Kind: instance property of KeyboardEvent
Determines if the Ctrl modifier was being pressed with the key. If the key is not a special key, this is always false.
Kind: instance property of KeyboardEvent
Determines if the Alt modifier was being pressed with the key.
Kind: instance property of KeyboardEvent
Determines if the Shift modifier was being pressed with the key. If the key is not a special key, this is always false.
Kind: instance property of KeyboardEvent
Determines if the Alt modifier was being pressed with the key. Present for compatibility with the readline module.
Kind: instance property of KeyboardEvent
Represents the key combination with a string in the format ["Ctrl+"]["Alt+"]["Shift+"]key.name. For example: "b", "B", "Ctrl+e", "Ctrl+Shift+home", "+".
Kind: instance method of KeyboardEvent
Represents a mouse event (click, wheel, etc.).
Kind: static class of Terminal
The x coordinate of where the mouse event happened (1 = leftmost column).
Kind: instance property of MouseEvent
The y coordinate of where the mouse event happened (1 = topmost row).
Kind: instance property of MouseEvent
The button number, in the range 1-11. This property might be undefined for mouseup and mousemove events. If undefined in a mousemove event, no button was pressed when the cursor moved.
List of mouse buttons (from http://xahlee.info/linux/linux_x11_mouse_button_number.html):
1: Left button2: Middle (wheel) button3: Right button4: Rotate wheel up5: Rotate wheel down6: Push wheel left7: Push wheel right8: 4th button or XButton1 (browser back)9: 5th button or XButton2 (browser forward)
Kind: instance property of MouseEvent
Determines if the Ctrl modifier was being pressed when the mouse event occurred.
Kind: instance property of MouseEvent
Determines if the Alt modifier was being pressed when the mouse event occurred.
Kind: instance property of MouseEvent
Determines if the Shift modifier was being pressed when the mouse event occurred.
Kind: instance property of MouseEvent
Type of mouse event (mousedown, mouseup, mousemove or wheel).
Kind: instance property of MouseEvent
Only for wheel events. Direction of the wheel turn (1 = down; -1 = up).
Kind: instance property of MouseEvent
Represents a highlight selection.
Kind: static class of Terminal
The x coordinate of the first character of the selection.
Kind: instance property of HighlightEvent
The y coordinate of the first character of the selection.
Kind: instance property of HighlightEvent
The x coordinate of the first character after the selection.
Kind: instance property of HighlightEvent
The y coordinate of the first character after the selection.
Kind: instance property of HighlightEvent
The x coordinate of the mouse position.
Kind: instance property of HighlightEvent
The y coordinate of the mouse position.
Kind: instance property of HighlightEvent
Constant used for enableMouse(): Only mousedown, mouseup and wheel events.
Kind: static constant of Terminal
Constant used for enableMouse(): Mouse highlight tracking. If you use this constant, make sure to respond to mousedown events with a proper escape sequence, otherwise the terminal may hang.
Kind: static constant of Terminal
Constant used for enableMouse(): Motion events only when buttons are down.
Kind: static constant of Terminal
Constant used for enableMouse(): All events.
Kind: static constant of Terminal
Kind: inner typedef of Terminal
Properties
| Name | Type | Default | Description |
|---|---|---|---|
| timeout | number |
500 |
The escape sequence timeout, in milliseconds. tty-events will stop waiting for the rest of an escape sequence when the timeout fires. Infinity = no timeout. |
| encoding | string |
"utf-8" |
The encoding of the input stream. |