https://github.com/dtinth/headless-terminal
Headless xterm emulator in JavaScript, forked from tty.js's term.js.
https://github.com/dtinth/headless-terminal
Last synced: 6 months ago
JSON representation
Headless xterm emulator in JavaScript, forked from tty.js's term.js.
- Host: GitHub
- URL: https://github.com/dtinth/headless-terminal
- Owner: dtinth
- Created: 2013-02-01T18:44:06.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2014-02-15T05:10:32.000Z (almost 12 years ago)
- Last Synced: 2024-11-09T13:42:56.476Z (about 1 year ago)
- Language: JavaScript
- Size: 274 KB
- Stars: 35
- Watchers: 4
- Forks: 10
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# new HeadlessTerminal(cols, rows)
A headless terminal is a terminal with an internal screen buffer.
When the display is changed, the `change` event is emitted
with the display buffer as an argument.
__Note:__ Since v0.3 the API has been _completely changed_.
## Usage
```javascript
var HeadlessTerminal = require('headless-terminal')
var terminal = new HeadlessTerminal(80, 25)
terminal.write('write some data and ansi code')
console.log(terminal.displayBuffer.toString())
```
## Attributes
### displayBuffer
The underlying [screen-buffer](http://github.com/dtinth/screen-buffer)
## API
HeadlessTerminal inherits EventEmitter.
### write(whatever)
Writes some thing to the terminal.
After that, a change event will be emitted.
### resize(cols, rows)
Resizes the size of the terminal.
After that, a change event will be emitted.
## Events
### 'change' (buffer)
Emitted when something is written to the terminal.
The first argument will be the underlying screen-buffer.
## Static Members
### HeadlessTerminal.ScreenBuffer
The ScreenBuffer class.
## License
MIT