have json-ot initialize its own debug module, instead of relying on a window variable's existence
This commit is contained in:
parent
d3203d1c2a
commit
aa07dd31ee
@ -4,10 +4,9 @@ define([
|
|||||||
var ChainPad = window.ChainPad;
|
var ChainPad = window.ChainPad;
|
||||||
var JsonOT = {};
|
var JsonOT = {};
|
||||||
|
|
||||||
/* FIXME
|
|
||||||
resultOp after transform0() might be null, in which case you should return null
|
|
||||||
because it is simply a transformation which yields a "do nothing" operation */
|
|
||||||
var validate = JsonOT.validate = function (text, toTransform, transformBy) {
|
var validate = JsonOT.validate = function (text, toTransform, transformBy) {
|
||||||
|
var DEBUG = window.REALTIME_DEBUG = window.REALTIME_DEBUG || {};
|
||||||
|
|
||||||
var resultOp, text2, text3;
|
var resultOp, text2, text3;
|
||||||
try {
|
try {
|
||||||
// text = O (mutual common ancestor)
|
// text = O (mutual common ancestor)
|
||||||
@ -28,7 +27,7 @@ define([
|
|||||||
return resultOp;
|
return resultOp;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
var info = window.REALTIME_MODULE.ot_parseError = {
|
var info = DEBUG.ot_parseError = {
|
||||||
type: 'resultParseError',
|
type: 'resultParseError',
|
||||||
resultOp: resultOp,
|
resultOp: resultOp,
|
||||||
|
|
||||||
@ -40,11 +39,11 @@ define([
|
|||||||
text3: text3,
|
text3: text3,
|
||||||
error: e
|
error: e
|
||||||
};
|
};
|
||||||
console.log('Debugging info available at `window.REALTIME_MODULE.ot_parseError`');
|
console.log('Debugging info available at `window.REALTIME_DEBUG.ot_parseError`');
|
||||||
}
|
}
|
||||||
} catch (x) {
|
} catch (x) {
|
||||||
console.error(x);
|
console.error(x);
|
||||||
window.REALTIME_MODULE.ot_applyError = {
|
window.DEBUG.ot_applyError = {
|
||||||
type: 'resultParseError',
|
type: 'resultParseError',
|
||||||
resultOp: resultOp,
|
resultOp: resultOp,
|
||||||
|
|
||||||
@ -56,7 +55,7 @@ define([
|
|||||||
text3: text3,
|
text3: text3,
|
||||||
error: x
|
error: x
|
||||||
};
|
};
|
||||||
console.log('Debugging info available at `window.REALTIME_MODULE.ot_applyError`');
|
console.log('Debugging info available at `window.REALTIME_DEBUG.ot_applyError`');
|
||||||
}
|
}
|
||||||
|
|
||||||
// returning **null** breaks out of the loop
|
// returning **null** breaks out of the loop
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user