浏览代码

fixes onend() (#358)

* fixes onend()

* Update speedtest.js
Niels Peen 5 年之前
父节点
当前提交
5cef820749
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      speedtest.js

+ 2 - 2
speedtest.js

@@ -330,13 +330,13 @@ Speedtest.prototype = {
         console.error("Speedtest onupdate event threw exception: " + e);
       }
       if (data.testState >= 4) {
+	  clearInterval(this.updater);
+        this._state = 4;
         try {
           if (this.onend) this.onend(data.testState == 5);
         } catch (e) {
           console.error("Speedtest onend event threw exception: " + e);
         }
-        clearInterval(this.updater);
-        this._state = 4;
       }
     }.bind(this);
     this.updater = setInterval(