test
This commit is contained in:
parent
ea22c5c594
commit
ada3f67689
@ -286,48 +286,45 @@ export function ActionItem(p: { action: ActionInfo, identifierSubstring?: string
|
|||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
<script>
|
<script>
|
||||||
|
const terminalContainer = document.getElementById('root');
|
||||||
|
|
||||||
window.onload = function() {
|
const terminal = new Terminal();
|
||||||
const terminalContainer = document.getElementById('root');
|
const fitAddon = new FitAddon();
|
||||||
|
terminal.loadAddon(fitAddon);
|
||||||
|
terminal.open(terminalContainer);
|
||||||
|
fitAddon.fit();
|
||||||
|
|
||||||
const terminal = new Terminal();
|
if (websocket) {
|
||||||
const fitAddon = new FitAddon();
|
const socket = new WebSocket("`+websocket+`");
|
||||||
terminal.loadAddon(fitAddon);
|
|
||||||
terminal.open(terminalContainer);
|
|
||||||
fitAddon.fit();
|
|
||||||
|
|
||||||
if (websocket) {
|
socket.onerror = (ev) => {
|
||||||
const socket = new WebSocket("`+websocket+`");
|
console.log(ev);
|
||||||
|
};
|
||||||
|
|
||||||
socket.onerror = (ev) => {
|
socket.addEventListener('open', () => {
|
||||||
console.log(ev);
|
socket.send(JSON.stringify({ CommandType: 'resize', Arguments: \`\${terminal.cols}x\${terminal.rows}\` }));
|
||||||
};
|
|
||||||
|
|
||||||
socket.addEventListener('open', () => {
|
|
||||||
socket.send(JSON.stringify({ CommandType: 'resize', Arguments: \`\${terminal.cols}x\${terminal.rows}\` }));
|
|
||||||
});
|
|
||||||
|
|
||||||
terminal.onResize(({ cols, rows }) => {
|
|
||||||
socket.send(JSON.stringify({ CommandType: 'resize', Arguments: \`\${cols}x\${rows}\` }));
|
|
||||||
});
|
|
||||||
|
|
||||||
socket.addEventListener('message', (event) => {
|
|
||||||
terminal.write(JSON.parse(event.data));
|
|
||||||
});
|
|
||||||
|
|
||||||
terminal.onData((data) => {
|
|
||||||
socket.send(JSON.stringify({ CommandType: 'insert', Arguments: data }));
|
|
||||||
});
|
|
||||||
|
|
||||||
window.addEventListener('beforeunload', () => {
|
|
||||||
socket.close();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
window.addEventListener('resize', () => {
|
|
||||||
fitAddon.fit();
|
|
||||||
});
|
});
|
||||||
};
|
|
||||||
|
terminal.onResize(({ cols, rows }) => {
|
||||||
|
socket.send(JSON.stringify({ CommandType: 'resize', Arguments: \`\${cols}x\${rows}\` }));
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.addEventListener('message', (event) => {
|
||||||
|
terminal.write(JSON.parse(event.data));
|
||||||
|
});
|
||||||
|
|
||||||
|
terminal.onData((data) => {
|
||||||
|
socket.send(JSON.stringify({ CommandType: 'insert', Arguments: data }));
|
||||||
|
});
|
||||||
|
|
||||||
|
window.addEventListener('beforeunload', () => {
|
||||||
|
socket.close();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener('resize', () => {
|
||||||
|
fitAddon.fit();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user