2023-11-01 10:35:10 -07:00
|
|
|
## @xterm/addon-attach
|
2019-09-09 09:28:33 -07:00
|
|
|
|
|
|
|
|
An addon for [xterm.js](https://github.com/xtermjs/xterm.js) that enables attaching to a web socket. This addon requires xterm.js v4+.
|
|
|
|
|
|
|
|
|
|
### Install
|
|
|
|
|
|
|
|
|
|
```bash
|
2023-11-01 10:35:10 -07:00
|
|
|
npm install --save @xterm/addon-attach
|
2019-09-09 09:28:33 -07:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
|
|
|
|
|
|
```ts
|
2023-11-01 06:50:08 -07:00
|
|
|
import { Terminal } from '@xterm/xterm';
|
2023-11-01 10:35:10 -07:00
|
|
|
import { AttachAddon } from '@xterm/addon-attach';
|
2019-09-09 09:28:33 -07:00
|
|
|
|
|
|
|
|
const terminal = new Terminal();
|
|
|
|
|
const attachAddon = new AttachAddon(webSocket);
|
|
|
|
|
terminal.loadAddon(attachAddon);
|
|
|
|
|
```
|
|
|
|
|
|
2023-11-01 10:35:10 -07:00
|
|
|
See the full [API](https://github.com/xtermjs/xterm.js/blob/master/addons/addon-attach/typings/addon-attach.d.ts) for more advanced usage.
|