Detect connection speed with JavaScript
Install with npm
$ npm install detect-connection-speed
Or install with yarn
$ yarn add detect-connection-speed
import DetectConnectionSpeed from 'detect-connection-speed';
Or umd builds are also available
<script src="path/to/detectConnectionSpeed.js"></script>
Will expose the global variable to window.DetectConnectionSpeed
.
// Init
var detect = new DetectConnectionSpeed({
url: '',
loop: true,
time: 1000,
detectCallback: function(result) {
console.log(result);
}
});
// Destroy
detect.destroy();
MIT © Harvey Zack