From 57cb32de7e904763162245198f6b212c36b6014f Mon Sep 17 00:00:00 2001 From: Guillermo Rauch Date: Mon, 25 Sep 2017 14:00:11 +0200 Subject: [PATCH] avoid double requestAnimationFrame loop since xterm already has one --- lib/index.js | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/lib/index.js b/lib/index.js index 18aedf08..7938dcb3 100644 --- a/lib/index.js +++ b/lib/index.js @@ -46,28 +46,11 @@ rpc.on('session add', data => { // we aggregate all the incoming pty events by raf // debouncing, to reduce allocation and iterations -let req; -let objects = {}; rpc.on('session data', d => { // the uid is a uuid v4 so it's 36 chars long const uid = d.slice(0, 36); const data = d.slice(36); - if (objects[uid] === undefined) { - objects[uid] = data; - } else { - objects[uid] += data; - } - if (!req) { - req = requestAnimationFrame(() => { - for (const i in objects) { - if ({}.hasOwnProperty.call(objects, i)) { - store_.dispatch(sessionActions.addSessionData(i, objects[i])); - } - } - objects = {}; - req = null; - }); - } + store_.dispatch(sessionActions.addSessionData(uid, data)); }); rpc.on('session data send', ({uid, data, escaped}) => {