more testing and crap
This commit is contained in:
@@ -52,7 +52,7 @@ define([
|
||||
|
||||
// ------------------ Trapping Keyboard Events ---------------------- //
|
||||
|
||||
var bindEvents = function (element, events, callback, unbind) {
|
||||
var _unused_bindEvents = function (element, events, callback, unbind) {
|
||||
for (var i = 0; i < events.length; i++) {
|
||||
var e = events[i];
|
||||
if (element.addEventListener) {
|
||||
@@ -71,7 +71,7 @@ define([
|
||||
}
|
||||
};
|
||||
|
||||
var bindAllEvents = function (textarea, docBody, onEvent, unbind)
|
||||
var _unused_bindAllEvents = function (textarea, docBody, onEvent, unbind)
|
||||
{
|
||||
/*
|
||||
we use docBody for the purposes of CKEditor.
|
||||
@@ -208,8 +208,10 @@ define([
|
||||
// assert things here...
|
||||
if (realtime.getUserDoc() !== newText) {
|
||||
// this is a problem
|
||||
// warn("realtime.getUserDoc() !== newText");
|
||||
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
|
||||
@@ -255,11 +257,14 @@ define([
|
||||
}
|
||||
});
|
||||
|
||||
// TODO improve this RegExp such that it allows for more names
|
||||
// right now it only handles names generated by rand64()
|
||||
var whoami = new RegExp(userName.replace(/[\/\+]/g, function (c) {
|
||||
return '\\' +c;
|
||||
}));
|
||||
realtime.onPatch(function () {
|
||||
if (config.onRemote) {
|
||||
config.onRemote({
|
||||
realtime: realtime
|
||||
//realtime.getUserDoc()
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// when you receive a message...
|
||||
socket.onMessage.push(function (evt) {
|
||||
@@ -270,10 +275,11 @@ define([
|
||||
verbose(message);
|
||||
allMessages.push(message);
|
||||
if (!initializing) {
|
||||
if (PARANOIA) {
|
||||
// FIXME this is out of sync with the application logic
|
||||
onEvent();
|
||||
}
|
||||
// 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"); }
|
||||
@@ -281,16 +287,9 @@ define([
|
||||
if (!initializing) {
|
||||
if (/\[2,/.test(message)) {
|
||||
//verbose("Got a patch");
|
||||
if (whoami.test(message)) {
|
||||
//verbose("Received own message");
|
||||
} else {
|
||||
//verbose("Received remote message");
|
||||
// obviously this is only going to get called if... XXX wat
|
||||
if (config.onRemote) { config.onRemote({
|
||||
realtime: realtime
|
||||
//realtime.getUserDoc()
|
||||
}); }
|
||||
}
|
||||
|
||||
//TODO clean this all up
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -329,7 +328,7 @@ define([
|
||||
}, 200);
|
||||
|
||||
// TODO maybe push this out to the application layer.
|
||||
bindAllEvents(null, doc, onEvent, false);
|
||||
//bindAllEvents(null, doc, onEvent, false);
|
||||
|
||||
// TODO rename 'sharejs.attach' to imply what we want to do
|
||||
var genOp = toReturn.propogate = sharejs.attach({
|
||||
|
||||
Reference in New Issue
Block a user