Skip to content

Commit

Permalink
Use |thisArg| instead of ths = this; Fixes yeomangh-329
Browse files Browse the repository at this point in the history
  • Loading branch information
rwaldron committed Sep 11, 2012
1 parent daaab6e commit eee8351
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions cli/lib/support/confess.js
Expand Up @@ -78,7 +78,10 @@ var confess = {
slowest, fastest, totalDuration = 0,
largest, smallest, totalSize = 0,
missingSize = false,
elapsed = finish - start;
elapsed = finish - start,
length = 104,
ratio = length / elapsed,
bar;

resources.forEach(function (resource) {
if (!resource.times.start) {
Expand Down Expand Up @@ -123,27 +126,23 @@ var confess = {
console.log(' Total resources: ' + this.pad(totalSize, 7) + 'b' + (missingSize ? '; (at least)' : ''));
if (config.verbose) {
console.log('');
var ths = this,
length = 104,
ratio = length / elapsed,
bar;
resources.forEach(function (resource) {
bar = ths.repeat(' ', (resource.times.request - start) * ratio) +
ths.repeat('-', (resource.times.start - resource.times.request) * ratio) +
ths.repeat('=', (resource.times.end - resource.times.start) * ratio)
bar = this.repeat(' ', (resource.times.request - start) * ratio) +
this.repeat('-', (resource.times.start - resource.times.request) * ratio) +
this.repeat('=', (resource.times.end - resource.times.start) * ratio)
;
bar = bar.substr(0, length) + ths.repeat(' ', length - bar.length);
console.log(ths.pad(resource.id, 3) + '|' + bar + '|');
});
bar = bar.substr(0, length) + this.repeat(' ', length - bar.length);
console.log(this.pad(resource.id, 3) + '|' + bar + '|');
}, this);
console.log('');
resources.forEach(function (resource) {
console.log(
ths.pad(resource.id, 3) + ': ' +
ths.pad(resource.duration, 6) + 'ms; ' +
ths.pad(resource.size, 7) + 'b; ' +
ths.truncate(resource.url, 84)
this.pad(resource.id, 3) + ': ' +
this.pad(resource.duration, 6) + 'ms; ' +
this.pad(resource.size, 7) + 'b; ' +
this.truncate(resource.url, 84)
);
});
}, this);
}
}
},
Expand Down

0 comments on commit eee8351

Please sign in to comment.