ghostty-web-umd-bindgen 0.1.0

wasm-bindgen bindings for the ghostty-web UMD global GhosttyWeb
Documentation

ghostty-web-umd-bindgen

Crates.io docs.rs

wasm-bindgen bindings for the ghostty-web UMD global GhosttyWeb.
It tries to mirror the definitions from ghostty-web/dist/index.d.ts. Created from the ghostty-web version 0.4.0.

Example

use ghostty_web_umd_bindgen::Terminal;
use ghostty_web_umd_bindgen::builders::{theme, terminal_options};
use web_sys::window;
use web_sys::HtmlElement;

let document = window().and_then(|win| win.document()).unwrap();
let terminal_container = document
    .get_element_by_id("terminal")
    .unwrap()
    .dyn_into::<HtmlElement>()
    .unwrap();

let theme_options = theme().foreground("#1a1b26".into()).background("#a9b1d6".into()).call();
let terminal_options = terminal_options().font_size(14.0).theme(theme_options).call();

let terminal = Terminal::new(Some(&terminal_options));
terminal.open(&terminal_container);

Demo

A runnable demo lives in demo/.
For the demo purpose, the terminal just writes the data back to the terminal. No data processing is implemented.

Prerequisites: trunk and the wasm32-unknown-unknown target.

cd demo
trunk serve

Then open http://localhost:8080.