Gathering detailed insights and metrics for react-detect-offline-api
Gathering detailed insights and metrics for react-detect-offline-api
npm install react-detect-offline-api
Typescript
Module System
Min. Node Version
Node Version
NPM Version
65.8
Supply Chain
80.2
Quality
74.8
Maintenance
100
Vulnerability
99.6
License
TypeScript (92.05%)
JavaScript (7.95%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
13,700
Last Day
4
Last Week
29
Last Month
80
Last Year
954
MIT License
36 Stars
147 Commits
9 Forks
4 Watchers
13 Branches
5 Contributors
Updated on Jan 26, 2025
Minified
Minified + Gzipped
Latest Version
1.0.3
Package Id
react-detect-offline-api@1.0.3
Unpacked Size
57.49 kB
Size
8.41 kB
File Count
8
NPM Version
6.4.1
Node Version
8.9.4
Cumulative downloads
Total Downloads
Last Day
100%
4
Compared to previous day
Last Week
107.1%
29
Compared to previous week
Last Month
70.2%
80
Compared to previous month
Last Year
-41.6%
954
Compared to previous year
3
20
1npm install --save react-detect-offline-api
1import * as React from 'react' 2 3import ReactDetectOfflineAPI from 'react-detect-offline-api' 4 5class Example extends React.Component { 6 render () { 7 return ( 8 <ReactDetectOfflineAPI 9 apiUrl={'http://yourapiurl.com'} 10 checkInterval={5000} 11 onOnline={() => { 12 console.log('Online') 13 }} 14 onOffline={error => { 15 console.log(error && error.status ? 'Offline with error:' + error.status : 'Offline') 16 }} 17 initialStatusCallback={status => { 18 console.log('Initial status ', status ? 'online' : 'offline') 19 }} 20 resolveOnlineStatusFromPromise={response => response.status === 'healthy'} 21 render={({ online }) => 22 online 23 ? 24 <div>Online</div> 25 : 26 <div>Offline</div> 27 } /> 28 ) 29 } 30}
Please note that if a request is blocked by CORS policy, this component will not work.
Props | Required | Type | Description |
---|---|---|---|
apiUrl | true | string | API to check |
checkInterval | true | number | null | Polling interval. If null, there will be only one check on componentDidMount |
render | false | Function | We're using Render Props to render online of offline component. See an example for more info. |
onOnline | false | Function | Called once an API becomes online and was offline |
onOffline | false | Function | Called once an API becomes offline and was online, in case API call was unsuccessful, it gets error as parameter |
resolveOnlineStatusFromPromise | false | (response: Object) => boolean | Called to detect online status from response after successful API call, otherwise every successful API call would be considered as online status |
initialStatusCallback | false | (status: boolean) => void | Calledback that returnes an initial status |
MIT | Developed by Webscope.io
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
Found 0/6 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
54 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-02-03
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More