-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from yomaytk/xterm
Add sample html script for xterm-pty.
- Loading branch information
Showing
2 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -116,4 +116,6 @@ examples/tests | |
|
||
# release | ||
SHA* | ||
elfconv-v* | ||
elfconv-v* | ||
|
||
!examples/browser/exe.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |