Merge branch 'diffdom' into netflux
This commit is contained in:
@@ -264,7 +264,8 @@ define([
|
||||
}, 200);
|
||||
|
||||
toReturn.patchText = TextPatcher.create({
|
||||
realtime: realtime
|
||||
realtime: realtime,
|
||||
logging: true
|
||||
});
|
||||
|
||||
realtime.start();
|
||||
|
||||
@@ -23,8 +23,8 @@ var diff = function (oldval, newval) {
|
||||
commonEnd++;
|
||||
}
|
||||
|
||||
var toRemove;
|
||||
var toInsert;
|
||||
var toRemove = 0;
|
||||
var toInsert = '';
|
||||
|
||||
/* throw some assertions in here before dropping patches into the realtime */
|
||||
if (oldval.length !== commonStart + commonEnd) {
|
||||
@@ -79,14 +79,15 @@ var log = function (text, op) {
|
||||
Due to its reliance on patch, applyChange has side effects on the supplied
|
||||
realtime facade.
|
||||
*/
|
||||
var applyChange = function(ctx, oldval, newval) {
|
||||
var applyChange = function(ctx, oldval, newval, logging) {
|
||||
var op = diff(oldval, newval);
|
||||
// log(oldval, op)
|
||||
if (logging) { log(oldval, op) }
|
||||
patch(ctx, op);
|
||||
};
|
||||
|
||||
var create = function(config) {
|
||||
var ctx = config.realtime;
|
||||
var logging = config.logging;
|
||||
|
||||
// initial state will always fail the !== check in genop.
|
||||
// because nothing will equal this object
|
||||
@@ -100,7 +101,7 @@ var create = function(config) {
|
||||
// propogate()
|
||||
return function (newContent) {
|
||||
if (newContent !== content) {
|
||||
applyChange(ctx, ctx.getUserDoc(), newContent);
|
||||
applyChange(ctx, ctx.getUserDoc(), newContent, logging);
|
||||
if (ctx.getUserDoc() !== newContent) {
|
||||
console.log("Expected that: `ctx.getUserDoc() === newContent`!");
|
||||
}
|
||||
|
||||
@@ -368,7 +368,7 @@ var random = Patch.random = function (doc, opCount) {
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
var PARANOIA = module.exports.PARANOIA = false;
|
||||
var PARANOIA = module.exports.PARANOIA = true;
|
||||
|
||||
/* throw errors over non-compliant messages which would otherwise be treated as invalid */
|
||||
var TESTING = module.exports.TESTING = true;
|
||||
@@ -832,7 +832,7 @@ var check = ChainPad.check = function(realtime) {
|
||||
Common.assert(uiDoc === realtime.userInterfaceContent);
|
||||
}
|
||||
|
||||
var doc = realtime.authDoc;
|
||||
/*var doc = realtime.authDoc;
|
||||
var patchMsg = realtime.best;
|
||||
Common.assert(patchMsg.content.inverseOf.parentHash === realtime.uncommitted.parentHash);
|
||||
var patches = [];
|
||||
@@ -844,7 +844,7 @@ var check = ChainPad.check = function(realtime) {
|
||||
while ((patchMsg = patches.pop())) {
|
||||
doc = Patch.apply(patchMsg.content, doc);
|
||||
}
|
||||
Common.assert(doc === realtime.authDoc);
|
||||
Common.assert(doc === realtime.authDoc);*/
|
||||
};
|
||||
|
||||
var doOperation = ChainPad.doOperation = function (realtime, op) {
|
||||
|
||||
Reference in New Issue
Block a user