From 5dfcb8dd3e57c2b0da98935e420609b49f7d8486 Mon Sep 17 00:00:00 2001 From: Shuanglei Tao Date: Sat, 22 Jun 2019 07:42:39 +0800 Subject: [PATCH] html: attach the term instance to window --- html/src/components/terminal/index.tsx | 1 + src/index.html | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/html/src/components/terminal/index.tsx b/html/src/components/terminal/index.tsx index 55aedc0..2f159ed 100644 --- a/html/src/components/terminal/index.tsx +++ b/html/src/components/terminal/index.tsx @@ -86,6 +86,7 @@ export default class Xterm extends Component { this.socket = new WebSocket(this.props.url, ['tty']); this.terminal = new Terminal(this.props.options); const { socket, terminal, container, fitAddon, overlayAddon } = this; + (window as any).term = terminal; socket.binaryType = 'arraybuffer'; socket.onopen = this.onSocketOpen; diff --git a/src/index.html b/src/index.html index 1587364..2d3d9bf 100644 --- a/src/index.html +++ b/src/index.html @@ -1 +1 @@ -ttyd - Terminal \ No newline at end of file +ttyd - Terminal \ No newline at end of file -- 2.43.4