fix resize event error when websocket closed (#1970)

This commit is contained in:
Bigbang
2021-12-03 11:35:54 +08:00
committed by GitHub
parent 65e98b1cea
commit 2924c81e4f
2 changed files with 10 additions and 6 deletions
@@ -18,9 +18,11 @@
<script type="text/javascript">
window.addEventListener('resize', function () {
var terminalSize = getTerminalSize();
ws.send(JSON.stringify({ action: 'resize', cols: terminalSize.cols, rows: terminalSize.rows }));
xterm.resize(terminalSize.cols, terminalSize.rows);
if(ws !== undefined && ws !== null){
let terminalSize = getTerminalSize();
ws.send(JSON.stringify({ action: 'resize', cols: terminalSize.cols, rows: terminalSize.rows }));
xterm.resize(terminalSize.cols, terminalSize.rows);
}
});
</script>
@@ -18,9 +18,11 @@
<script type="text/javascript">
window.addEventListener('resize', function () {
var terminalSize = getTerminalSize();
ws.send(JSON.stringify({ action: 'resize', cols: terminalSize.cols, rows: terminalSize.rows }));
xterm.resize(terminalSize.cols, terminalSize.rows);
if(ws !== undefined && ws !== null){
let terminalSize = getTerminalSize();
ws.send(JSON.stringify({ action: 'resize', cols: terminalSize.cols, rows: terminalSize.rows }));
xterm.resize(terminalSize.cols, terminalSize.rows);
}
});
</script>