flush_local_changes: function() { var ops = localChanges2.concat(localChanges1); var ops = ot_base.normalize_array(ops); if (ops.length > 0) collab.local_revision(ops); localChanges1 = []; localChanges2 = []; }
window.jot_send_changes_over_the_wire = function() { var ops = ot_base.normalize_array(localChanges2); if (ops.length > 0) { collab.local_revision(ops); // send whole arrays time_since_last_op = 0; // If there was no operation to send on this iteration, see if it's // time to send a period ping, which acknowledges that we're caught // up with the most recent remote revision we've received. That let's // the other end clear buffers. } else if (collab.needs_ack && time_since_last_op > max_ack_time) { collab.send_ping(); time_since_last_op = 0; } else { time_since_last_op += 1; } localChanges2 = localChanges1; localChanges1 = []; queue_send_changes(); }