Skip to content

Commit

Permalink
Revert "change demo to utf8 input"
Browse files Browse the repository at this point in the history
This reverts commit e6e5ecc.
  • Loading branch information
jerch committed May 12, 2019
1 parent 06c292c commit c0e9bbe
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
1 change: 0 additions & 1 deletion demo/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ function createTerminal(): void {
pid = processId;
socketURL += processId;
socket = new WebSocket(socketURL);
socket.binaryType = 'arraybuffer';
socket.onopen = runRealTerminal;
socket.onclose = runFakeTerminal;
socket.onerror = runFakeTerminal;
Expand Down
13 changes: 6 additions & 7 deletions demo/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ function startServer() {
cols: cols || 80,
rows: rows || 24,
cwd: process.env.PWD,
env: process.env,
encoding: null
env: process.env
});

console.log('Created terminal with PID: ' + term.pid);
Expand Down Expand Up @@ -67,20 +66,20 @@ function startServer() {
ws.send(logs[term.pid]);

function buffer(socket, timeout) {
let buffer = [];
let s = '';
let sender = null;
return (data) => {
buffer.push(data);
s += data;
if (!sender) {
sender = setTimeout(() => {
socket.send(Buffer.concat(buffer));
buffer = [];
socket.send(s);
s = '';
sender = null;
}, timeout);
}
};
}
const send = buffer(ws, 5);
const send = buffer(ws, 5);

term.on('data', function(data) {
try {
Expand Down
5 changes: 0 additions & 5 deletions src/addons/attach/attach.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ export function attach(term: Terminal, socket: WebSocket, bidirectional: boolean
addonTerminal.__getMessage = function(ev: MessageEvent): void {
let str: string;

if (ev.data instanceof ArrayBuffer) {
addonTerminal.writeUtf8(new Uint8Array(ev.data));
return;
}

if (typeof ev.data === 'object') {
if (!myTextDecoder) {
myTextDecoder = new TextDecoder();
Expand Down

0 comments on commit c0e9bbe

Please sign in to comment.