Skip to content

Commit

Permalink
Merge pull request #62 from yomaytk/xterm
Browse files Browse the repository at this point in the history
Add sample html script for xterm-pty.
  • Loading branch information
yomaytk authored Oct 23, 2024
2 parents 6433366 + d5e3513 commit ec6dac1
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,6 @@ examples/tests

# release
SHA*
elfconv-v*
elfconv-v*

!examples/browser/exe.html
29 changes: 29 additions & 0 deletions examples/browser/exe.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!-- requires ./exe.js ./exe.wasm -->

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/css/xterm.css" />
</head>
<body>
<div id="terminal"></div>
<script type="module">
import 'https://cdn.jsdelivr.net/npm/[email protected]/lib/xterm.min.js';
import 'https://cdn.jsdelivr.net/npm/[email protected]/index.js';
import initEmscripten from './exe.js';

var xterm = new Terminal();
xterm.open(document.getElementById('terminal'));

// Create master/slave objects
const { master, slave } = openpty();

// Connect the master object to xterm.js
xterm.loadAddon(master);

await initEmscripten({
pty: slave
});
</script>
</body>
</html>

0 comments on commit ec6dac1

Please sign in to comment.