Skip to content

Commit

Permalink
Merge pull request #58 from rotosonic/SetOnProgressTimerToVariable
Browse files Browse the repository at this point in the history
Move hardcoded value to variable
  • Loading branch information
rotosonic authored Dec 6, 2016
2 parents f571ff2 + 9479add commit 5404580
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "speed-testjs",
"version": "1.0.4",
"version": "1.0.5",
"description": "measure internet bandwidth",
"main": "index.js",
"author": "Maulan Byron",
Expand Down
3 changes: 2 additions & 1 deletion public/lib/xmlhttprequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
this.progressCount = 0;
this.totalBytes = 0;
this.currentTime = 0;
this.progressInterval = 50;
this.callbackComplete = callbackComplete;
this.callbackProgress = callbackProgress;
this.callbackAbort = callbackAbort;
Expand Down Expand Up @@ -227,7 +228,7 @@
result.id = this.id;
this.currentTime = Date.now();
result.totalTime = this.currentTime - this.prevTime;
if (result.totalTime > 50) {
if (result.totalTime > this.progressInterval) {
var transferSizeMbs = ((response.loaded - this.prevLoad) * 8) / 1000000;
var transferDurationSeconds = result.totalTime / 1000;
result.bandwidth = transferSizeMbs / transferDurationSeconds;
Expand Down

0 comments on commit 5404580

Please sign in to comment.