Notify on internet speed changes
In later version default image will be removed. It is recommended to give address of image on your server/s. As it will give you more usefull and reliable values.
npm install --save react-internet-meter
import React from 'react'
import { ReactInternetSpeedMeter } from 'react-internet-meter'
import 'react-internet-speed-meter/dist/index.css'
const App = () => {
<ReactInternetSpeedMeter
txtSubHeading="Internet is too slow"
outputType="alert"
customClassName={null}
txtMainHeading="Opps..."
pingInterval={4000} // milliseconds
thresholdUnit='megabyte' // "byte" , "kilobyte", "megabyte"
threshold={100}
imageUrl="https://res.cloudinary.com/dcwxsms2l/image/upload/v1610376487/pexels-ivan-samkov-6291574_bzqgps.jpg"
downloadSize="1781287" //bytes
callbackFunctionOnNetworkDown={(speed)=>console.log(`Internet speed is down ${speed}`)}
callbackFunctionOnNetworkTest={(speed)=>setwifiSpeed(speed)}
/>
}
export default App
Parameter | Type | Options |
---|---|---|
txtSubHeading | string | any string you want |
outputType | string | "alert"/"modal"/"empty" |
customClassName | string | css class you want |
txtMainHeading | string | any string you want |
pingInterval | integer | time in milliseconds |
thresholdUnit | string | "byte"/"kilobyte"/"megabyte" |
threshold | Integer | Minimum required value |
callbackFunctionOnNetworkDown | function | Function that run on network down |
callbackFunctionOnNetworkTest | function | Function that run after network check |
imageUrl | string | dummy image url |
callbackFunctionOnNetworkTest | string | image size |
MIT © rajanlagah
alert-when-internet-speed-go-below-threshold
Dont forget to give star to this repo on github...