Skip to content

Commit 8347df0

Browse files
committed
fix(gritty) return {socket, terminal}
1 parent c0899af commit 8347df0

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

client/gritty.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ module.exports = (element, options = {}) => {
3333
}
3434

3535
function createTerminal(terminalContainer, {env, socketPath, prefix}) {
36-
const term = new Terminal({
36+
const terminal = new Terminal({
3737
cursorBlink: true,
3838
scrollback: 1000,
3939
tabStopWidth: 4,
@@ -42,32 +42,35 @@ function createTerminal(terminalContainer, {env, socketPath, prefix}) {
4242

4343
const socket = connect(prefix, socketPath);
4444

45-
term.on('resize', (size) => {
45+
terminal.on('resize', (size) => {
4646
const {cols, rows} = size;
4747

4848
socket.emit('resize', {cols, rows});
4949
});
5050

51-
term.on('data', (data) => {
51+
terminal.on('data', (data) => {
5252
socket.emit('data', data);
5353
});
5454

5555
window.addEventListener('resize', () => {
56-
term.fit();
56+
terminal.fit();
5757
});
5858

59-
term.open(terminalContainer);
60-
term.fit();
59+
terminal.open(terminalContainer);
60+
terminal.fit();
6161

62-
const {cols, rows} = term.proposeGeometry()
62+
const {cols, rows} = terminal.proposeGeometry()
6363

6464
socket.emit('terminal', {env, cols, rows});
6565

6666
socket.on('data', (data) => {
67-
term.write(data);
67+
terminal.write(data);
6868
});
6969

70-
return socket;
70+
return {
71+
socket,
72+
terminal
73+
};
7174
}
7275

7376
function connect(prefix, socketPath) {

0 commit comments

Comments
 (0)