Gathering detailed insights and metrics for @webscopeio/react-health-check
Gathering detailed insights and metrics for @webscopeio/react-health-check
Gathering detailed insights and metrics for @webscopeio/react-health-check
Gathering detailed insights and metrics for @webscopeio/react-health-check
npm install @webscopeio/react-health-check
Typescript
Module System
Node Version
NPM Version
TypeScript (92.05%)
JavaScript (7.95%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
28,961
Last Day
19
Last Week
201
Last Month
972
Last Year
6,827
MIT License
36 Stars
147 Commits
9 Forks
4 Watchers
13 Branches
5 Contributors
Updated on Jan 26, 2025
Minified
Minified + Gzipped
Latest Version
3.0.1
Package Id
@webscopeio/react-health-check@3.0.1
Unpacked Size
13.84 kB
Size
5.04 kB
File Count
9
NPM Version
8.13.2
Node Version
18.6.0
Cumulative downloads
Total Downloads
Last Day
-45.7%
19
Compared to previous day
Last Week
-28%
201
Compared to previous week
Last Month
326.3%
972
Compared to previous month
Last Year
-35.8%
6,827
Compared to previous year
21
Lightweight React hook for checking health of API services.
npm i @webscopeio/react-health-check
or
yarn add @webscopeio/react-health-check
1const { available, refresh } = useHealthCheck({
2 service: {
3 name: 'auth',
4 url: 'https://example.com/auth/health',
5 },
6 onSuccess: ({ service, timestamp }) => {
7 console.log(`Service "${service.name}" is available since "${timestamp}" 🎉`);
8 },
9 onError: ({ service, timestamp }) => {
10 console.log(`Service "${service.name}" is not available since "${timestamp}" 😔`);
11 },
12});
You can also create a global configuration so you don't have to define services and callbacks every time:
1// App wrapper 2<HealthCheckConfig 3 value={{ 4 services: [ 5 { 6 name: 'auth', 7 url: 'https://example.com/auth/health', 8 }, 9 { 10 name: 'payment', 11 url: 'https://example.com/payment/health', 12 }, 13 ], 14 onSuccess: ({ service, timestamp }) => { 15 console.log(`Service "${service.name}" is available since "${timestamp}" 🎉`); 16 }, 17 onError: ({ service, timestamp }) => { 18 console.log(`Service "${service.name}" is not available since "${timestamp}" 😔`); 19 }, 20 }} 21> 22 <App /> 23</HealthCheckConfig>; 24 25// Later in some child component 26const { available } = useHealthCheck('auth');
useHealthCheck()
hook accepts a configuration object with keys:
Key | Type | Description |
---|---|---|
service | Service<S = string> | Object defining an API service to be checked. |
onSuccess | (state: ServiceState<S>) => void; | Callback which should be called when API service becomes available again. |
onError | (state: ServiceState<S>) => void; | Callback which should be called when API service becomes unavailable. |
refreshInterval | number | Polling interval for health checks in milliseconds. Default value: 5000 |
refreshWhileHidden | boolean | Determines whether polling should be paused while browser window isn't visible. Default value: false |
Global configuration accepts the same keys as useHealthCheck()
hook with the exception of "service". You need to specify array of "services" when using global configuration.
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