react-internet-meter
v1.1.1
Published
Notify on internet speed changes
Downloads
3,947
Maintainers
Readme
react-internet-meter
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.
How it work ?
Install
npm install --save react-internet-meter
Usage
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 |
License
MIT © rajanlagah
Medium post
alert-when-internet-speed-go-below-threshold
Note
Dont forget to give star to this repo on github...