Просмотр исходного кода

The time limits are now ignored if the speed is still 0.00 when the limit is reached

dosse91 9 лет назад
Родитель
Сommit
b20c13728f
3 измененных файлов с 6 добавлено и 6 удалено
  1. 3 3
      doc.md
  2. 3 3
      speedtest_worker.js
  3. 0 0
      speedtest_worker.min.js

+ 3 - 3
doc.md

@@ -1,7 +1,7 @@
 # HTML5 Speedtest
 
 > by Federico Dossena  
-> Version 4.2.7, June 22 2017  
+> Version 4.2.8, July 16 2017  
 > [https://github.com/adolfintel/speedtest/](https://github.com/adolfintel/speedtest/)
 
 
@@ -130,10 +130,10 @@ w.postMessage('start {"param1": "value1", "param2": "value2", ...}')
 ```
 
 #### Test parameters
-* __time_dl__: How long the download test should be in seconds
+* __time_dl__: How long the download test should be in seconds. The test will continue regardless of this limit if the speed is still 0.00 when the limit is reached.
     * Default: `15`
     * Recommended: `>=5`
-* __time_ul__: How long the upload test should be in seconds
+* __time_ul__: How long the upload test should be in seconds. The test will continue regardless of this limit if the speed is still 0.00 when the limit is reached.
     * Default: `15`
     * Recommended: `>=10`
 * __count_ping__: How many pings to perform in the ping test

+ 3 - 3
speedtest_worker.js

@@ -1,5 +1,5 @@
 /*
-	HTML5 Speedtest v4.2.7
+	HTML5 Speedtest v4.2.8
 	by Federico Dossena
 	https://github.com/adolfintel/speedtest/
 	GNU LGPLv3 License
@@ -201,7 +201,7 @@ function dlTest (done) {
     }else{
       var speed = totLoaded / (t / 1000.0)
       dlStatus = ((speed * 8 * settings.overheadCompensationFactor)/1048576).toFixed(2) // speed is multiplied by 8 to go from bytes to bits, overhead compensation is applied, then everything is divided by 1048576 to go to megabits/s
-      if ((t / 1000.0) > settings.time_dl || failed) { // test is over, stop streams and timer
+      if (((t / 1000.0) > settings.time_dl && dlStatus > 0) || failed) { // test is over, stop streams and timer
         if (failed || isNaN(dlStatus)) dlStatus = 'Fail'
         clearRequests()
         clearInterval(interval)
@@ -306,7 +306,7 @@ function ulTest (done) {
     }else{
       var speed = totLoaded / (t / 1000.0)
       ulStatus = ((speed * 8 * settings.overheadCompensationFactor)/1048576).toFixed(2) // speed is multiplied by 8 to go from bytes to bits, overhead compensation is applied, then everything is divided by 1048576 to go to megabits/s
-      if ((t / 1000.0) > settings.time_ul || failed) { // test is over, stop streams and timer
+      if (((t / 1000.0) > settings.time_ul && ulStatus > 0) || failed) { // test is over, stop streams and timer
         if (failed || isNaN(ulStatus)) ulStatus = 'Fail'
         clearRequests()
         clearInterval(interval)

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
speedtest_worker.min.js


Некоторые файлы не были показаны из-за большого количества измененных файлов