From c32045d7d039fdb6147c15f7e28236246fa298ac Mon Sep 17 00:00:00 2001 From: Yann Flory Date: Thu, 14 Apr 2016 15:30:42 +0200 Subject: [PATCH] Fix an issue with missing characters when several users were typing at the same time --- www/common/hyperjson.js | 7 ------- www/common/realtime-input.js | 8 ++++++-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/www/common/hyperjson.js b/www/common/hyperjson.js index 27bee7cee..ff04a0da9 100644 --- a/www/common/hyperjson.js +++ b/www/common/hyperjson.js @@ -52,13 +52,6 @@ define([], function () { return x; }; - /* DOM2HyperJSON accepts a DOM element/node - and converts it into Hyperjson. It optionally accepts a predicate - which is used for filtering out subtrees of the DOM from the result. - - The function, if provided, must return true for elements which - should be preserved, and 'false' for elements which should be removed. - */ var DOM2HyperJSON = function(el, predicate, filter){ if(!el.tagName && el.nodeType === Node.TEXT_NODE){ return el.textContent; diff --git a/www/common/realtime-input.js b/www/common/realtime-input.js index 3fd00231d..437d5fb48 100644 --- a/www/common/realtime-input.js +++ b/www/common/realtime-input.js @@ -141,6 +141,11 @@ define([ verbose(message); allMessages.push(message); + if (!initializing) { + if (toReturn.onLocal) { + toReturn.onLocal(); + } + } // pass the message into Chainpad realtime.message(message); }; @@ -167,6 +172,7 @@ define([ messagesHistory.push(decryptedMsg); return decryptedMsg; } catch (err) { + console.error(err); return message; } @@ -283,8 +289,6 @@ define([ Netflux.connect(websocketUrl).then(function(network) { // pass messages that come out of netflux into our local handler - // TODO avoid calling findChannelById for each message - // but only if we can prove it won't introduce bugs network.on('message', function (msg, sender) { // Direct message var wchan = findChannelById(network.webChannels, channel); if(wchan) {