Installations
npm install react-detect-offline-api
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
>=8
Node Version
8.9.4
NPM Version
6.4.1
Score
65.8
Supply Chain
80.2
Quality
74.8
Maintenance
100
Vulnerability
99.6
License
Releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (92.05%)
JavaScript (7.95%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
webscopeio
Download Statistics
Total Downloads
13,700
Last Day
4
Last Week
29
Last Month
80
Last Year
954
GitHub Statistics
MIT License
36 Stars
147 Commits
9 Forks
4 Watchers
13 Branches
5 Contributors
Updated on Jan 26, 2025
Bundle Size
3.30 kB
Minified
1.39 kB
Minified + Gzipped
Package Meta Information
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
Total Downloads
Cumulative downloads
Total Downloads
13,700
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
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Peer Dependencies
3
Dev Dependencies
20
react-detect-offline-api
Install
1npm install --save react-detect-offline-api
Usage
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 |
License
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
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/webscopeio/react-health-check/node.js.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/webscopeio/react-health-check/node.js.yml/master?enable=pin
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 1 out of 1 npmCommand dependencies pinned
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/node.js.yml:1
- Info: no jobLevel write permissions found
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
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 29 are checked with a SAST tool
Reason
54 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw
- Warn: Project is vulnerable to: GHSA-w8qv-6jwh-64r5
- Warn: Project is vulnerable to: GHSA-7gc6-qh9x-w6h8
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq
- Warn: Project is vulnerable to: GHSA-r9p9-mrjm-926w
- Warn: Project is vulnerable to: GHSA-434g-2637-qmqr
- Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m
- Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw
- Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p
- Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747
- Warn: Project is vulnerable to: GHSA-4gmj-3p3h-gm8h
- Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq
- Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488
- Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-vxf5-wxwp-m7g9
- Warn: Project is vulnerable to: GHSA-25mp-g6fv-mqxx
- Warn: Project is vulnerable to: GHSA-c59h-r6p8-q9wc
- Warn: Project is vulnerable to: GHSA-w7rc-rwvf-8q5r
- Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g
- Warn: Project is vulnerable to: GHSA-cwx2-736x-mf6w
- Warn: Project is vulnerable to: GHSA-v39p-96qg-c8rf
- Warn: Project is vulnerable to: GHSA-8v63-cqqc-6r2c
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-566m-qj78-rww5
- Warn: Project is vulnerable to: GHSA-hwj9-h5mp-3pm3
- Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-g4rg-993r-mgx7
- Warn: Project is vulnerable to: GHSA-vx3p-948g-6vhq
- Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9
- Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw
- Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc
- Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh
- Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p
- Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36
- Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc
- Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh
- Warn: Project is vulnerable to: GHSA-x56p-c8cg-q435
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
Score
3
/10
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