Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/daniel-boll/ratatui.ts
Ratatui port to TypeScript
https://github.com/daniel-boll/ratatui.ts
Last synced: about 17 hours ago
JSON representation
Ratatui port to TypeScript
- Host: GitHub
- URL: https://github.com/daniel-boll/ratatui.ts
- Owner: Daniel-Boll
- Created: 2024-06-20T23:20:12.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-06-21T02:52:50.000Z (5 months ago)
- Last Synced: 2024-06-21T21:33:37.785Z (5 months ago)
- Language: JavaScript
- Size: 39.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
ratatui.ts
## Examples
```ts
import { Terminal, Stdout, Paragraph, Event } from "@lambda-group/ratatui.ts";
import type { Frame } from "@lambda-group/ratatui.ts";using terminal = new Terminal(); // We leave terminal.restore() to [Symbol.dispose], although it may be done manually.
terminal.setup([Stdout.EnterAlternateScreen]);
while (true) {
terminal.draw(renderApp);
if (shouldQuit()) break;
}function renderApp(frame: Frame) {
frame.renderWidget(
new Paragraph("Hello, World! (press 'q' to quit)"),
frame.size(),
);
}function shouldQuit() {
if (Event.poll(250)) return Event.read()?.code == KeyCode.char("q");
}// here `terminal.restore([Stdout.LeaveAlternateScreen]);` is unnecessary because of the [Symbol.dispose] implementation for the Terminal
```