Shuffled around some assertions and logs

pull/1/head
Caleb James DeLisle 9 years ago
parent 420a7098a6
commit f62ec85a4c

@ -197,6 +197,11 @@ define([
// build a dom from HJSON, diff, and patch the editor
applyHjson(shjson);
//updateDebugTextarea(shjson);
var shjson2 = JSON.stringify(Convert.core.hyperjson.fromDOM(inner));
if (shjson2 !== shjson) {
throw new Error("change after conversion");
}
};
var onInit = function (info) {
@ -260,9 +265,7 @@ define([
var rti = module.realtimeInput = window.rti = realtimeInput.start(realtimeOptions);
var propogate = window.cryptpad_propogate = function () {
var hjson = Convert.core.hyperjson.fromDOM(inner, isNotMagicLine);
var shjson = JSON.stringify(hjson);
var shjson = JSON.stringify(Convert.core.hyperjson.fromDOM(inner, isNotMagicLine));
if (!rti.propogate(shjson)) { return; }
rti.onEvent(shjson);
};

@ -211,7 +211,6 @@ define([
warn("realtime.getUserDoc() !== newText");
}
//try{throw new Error();}catch(e){console.log(e.stack);}
console.log("2: " + realtime.Sha.hex_sha256(realtime.getUserDoc()));
};
// pass your shiny new realtime into initialization functions
@ -276,10 +275,7 @@ define([
allMessages.push(message);
if (!initializing) {
// FIXME this is out of sync with the application logic
console.log("xxx");
window.cryptpad_propogate();
} else {
console.log("init");
}
realtime.message(message);
if (/\[5,/.test(message)) { verbose("pong"); }

@ -35,6 +35,7 @@ var applyChange = function(ctx, oldval, newval) {
if (newval.length !== commonStart + commonEnd) {
if (ctx.localChange) { ctx.localChange(true); }
ctx.insert(commonStart, newval.slice(commonStart, newval.length - commonEnd));
console.log("insert: " + newval.slice(commonStart, newval.length - commonEnd));
}
};
@ -63,10 +64,8 @@ var attachTextarea = function(config) {
if (ctx.getUserDoc() !== newContent) {
console.log("Expected that: `ctx.getUserDoc() === newContent`!");
}
console.log("1: " + ctx.Sha.hex_sha256(ctx.getUserDoc()));
return true;
}
console.log("no change");
return false;
};
};

Loading…
Cancel
Save