Skip to content

Commit

Permalink
fixes onend() (librespeed#358)
Browse files Browse the repository at this point in the history
* fixes onend()

* Update speedtest.js
  • Loading branch information
nielspeen authored Sep 17, 2020
1 parent 3ccdd3d commit 5cef820
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions speedtest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 5cef820

Please sign in to comment.