From e039e90a248025ba5a70864dae8a71c34dec89cb Mon Sep 17 00:00:00 2001 From: Caleb James DeLisle Date: Fri, 30 Jan 2015 16:41:01 +0100 Subject: [PATCH] upgrade to most recent chainpad --- www/common/chainpad.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/www/common/chainpad.js b/www/common/chainpad.js index b872b17f0..275a774a4 100644 --- a/www/common/chainpad.js +++ b/www/common/chainpad.js @@ -1093,14 +1093,16 @@ var handleMessage = ChainPad.handleMessage = function (realtime, msgStr) { Common.assert(newUserInterfaceContent === realtime.userInterfaceContent); } - // push the uncommittedPatch out to the user interface. - for (var i = 0; i < realtime.patchHandlers.length; i++) { - realtime.patchHandlers[i](uncommittedPatch); - } - if (realtime.opHandlers.length) { - for (var i = uncommittedPatch.operations.length-1; i >= 0; i--) { - for (var j = 0; j < realtime.opHandlers.length; j++) { - realtime.opHandlers[j](uncommittedPatch.operations[i]); + if (uncommittedPatch.operations.length) { + // push the uncommittedPatch out to the user interface. + for (var i = 0; i < realtime.patchHandlers.length; i++) { + realtime.patchHandlers[i](uncommittedPatch); + } + if (realtime.opHandlers.length) { + for (var i = uncommittedPatch.operations.length-1; i >= 0; i--) { + for (var j = 0; j < realtime.opHandlers.length; j++) { + realtime.opHandlers[j](uncommittedPatch.operations[i]); + } } } }