code review

This commit is contained in:
gorhill 2015-01-07 11:36:23 -05:00
parent 4a5938d3dd
commit d639c63670
2 changed files with 4 additions and 9 deletions

View File

@ -123,7 +123,7 @@ var renderLogBuffer = function(buffer) {
/******************************************************************************/
var onBufferRead = function(buffer) {
if ( Array.isArray(buffer ) ) {
if ( Array.isArray(buffer) ) {
renderLogBuffer(buffer);
}
setTimeout(readLogBuffer, 1000);
@ -142,13 +142,8 @@ var readLogBuffer = function() {
/******************************************************************************/
var clearBuffer = function() {
var rows = tbody.rows;
var row;
var i = rows.length;
while ( i-- ) {
row = rows[i];
row.parentNode.removeChild(row);
rowJunkyard.push(row);
while ( tbody.firstChild !== null ) {
rowJunkyard.push(tbody.removeChild(tbody.firstChild));
}
};

View File

@ -159,7 +159,7 @@ LogBuffer.prototype.writeOne = function(details, result) {
if ( this.writePtr === this.readPtr ) {
var toMove = this.buffer.slice(0, this.writePtr);
var minSize = Math.ceil(this.size * 1.5);
this.size += this.writePtr;
this.size += toMove.length;
if ( this.size < minSize ) {
this.buffer = this.buffer.concat(toMove, new Array(minSize - this.size));
this.writePtr = this.size;