# xterm-addon-webgl

> An addon for [xterm.js](https://github.com/xtermjs/xterm.js) that enables a WebGL2-based renderer. This addon requires xterm.js v4+.

Latest version **0.16.0** (published 2023-09-07) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install xterm-addon-webgl
pnpm add xterm-addon-webgl
yarn add xterm-addon-webgl
bun add xterm-addon-webgl
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.16.0 |
| Published | 2023-09-07 |
| First published | 2019-06-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 543.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 21227 |
| Author | The xterm.js authors |
| Maintainers | tyriar |
| Keywords | terminal, webgl, xterm, xterm.js |

## Links

- npm: https://www.npmjs.com/package/xterm-addon-webgl
- Repository: https://github.com/xtermjs/xterm.js
- Homepage: https://github.com/xtermjs/xterm.js#readme
- Issues: https://github.com/xtermjs/xterm.js/issues
- npm.io page: https://npm.io/package/xterm-addon-webgl

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 0.16.0 (latest) — 2023-09-07
- 0.17.0-beta.36 (beta) — 2023-10-31
- 0.17.0-beta.35 — 2023-10-31
- 0.17.0-beta.34 — 2023-10-30
- 0.17.0-beta.33 — 2023-10-19
- 0.17.0-beta.32 — 2023-10-19
- 0.17.0-beta.31 — 2023-10-17
- 0.17.0-beta.30 — 2023-10-13
- 0.17.0-beta.29 — 2023-10-02
- 0.17.0-beta.28 — 2023-10-02
- 0.17.0-beta.27 — 2023-09-27
- 0.17.0-beta.26 — 2023-09-20
- 0.17.0-beta.25 — 2023-09-20
- 0.17.0-beta.24 — 2023-09-16
- 0.17.0-beta.23 — 2023-09-15
- … 330 more at https://npm.io/package/xterm-addon-webgl/versions

## README

## xterm-addon-webgl

An addon for [xterm.js](https://github.com/xtermjs/xterm.js) that enables a WebGL2-based renderer. This addon requires xterm.js v4+.

### Install

```bash
npm install --save xterm-addon-webgl
```

### Usage

```ts
import { Terminal } from 'xterm';
import { WebglAddon } from 'xterm-addon-webgl';

const terminal = new Terminal();
terminal.open(element);
terminal.loadAddon(new WebglAddon());
```

See the full [API](https://github.com/xtermjs/xterm.js/blob/master/addons/xterm-addon-webgl/typings/xterm-addon-webgl.d.ts) for more advanced usage.

### Handling Context Loss

The browser may drop WebGL contexts for various reasons like OOM or after the system has been suspended. There is an API exposed that fires the `webglcontextlost` event fired on the canvas so embedders can handle it however they wish. An easy, but suboptimal way, to handle this is by disposing of WebglAddon when the event fires:

```ts
const terminal = new Terminal();
const addon = new WebglAddon();
addon.onContextLoss(e => {
  addon.dispose();
});
terminal.loadAddon(addon);
```

Read more about handling WebGL context losses on the [Khronos wiki](https://www.khronos.org/webgl/wiki/HandlingContextLost).

### See also

- [xterm-addon-canvas](https://www.npmjs.com/package/xterm-addon-canvas) A renderer for xterm.js that uses a 2d canvas that can be used as a fallback when WebGL is not available

---
_Source: https://npm.io/package/xterm-addon-webgl · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
