Gathering detailed insights and metrics for @blackbox-vision/use-torch-light
Gathering detailed insights and metrics for @blackbox-vision/use-torch-light
Gathering detailed insights and metrics for @blackbox-vision/use-torch-light
Gathering detailed insights and metrics for @blackbox-vision/use-torch-light
npm install @blackbox-vision/use-torch-light
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
11 Stars
9 Commits
1 Forks
4 Watching
9 Branches
2 Contributors
Updated on 23 Apr 2024
TypeScript (92.6%)
JavaScript (7.4%)
Cumulative downloads
Total Downloads
Last day
-12.3%
876
Compared to previous day
Last week
13.4%
6,256
Compared to previous week
Last month
3.7%
24,966
Compared to previous month
Last year
1,022.7%
434,934
Compared to previous year
35
🔦 useTorchLight is a hook to enable/disable camera flash. Check out the demo.
You can install this library via NPM or YARN.
1npm i @blackbox-vision/use-torch-light
1yarn add @blackbox-vision/use-torch-light
useTorchLight relies on ImageCapture API whose spec isn't complete at all browsers currently. You can check the state of ImageCapture in browsers here.
We're currently trying to make the hook most consistent as possible by providing cross-browser checks and dispatching errors or alerts via success and error callbacks.
The usage is really simple:
1import React, { useState, useRef } from 'react'; 2import { QrReader } from '@blackbox-vision/react-qr-reader'; 3import { useTorchLight } from '@blackbox-vision/use-torch-light'; 4 5const Test = (props) => { 6 const streamRef = useRef(null); 7 8 const [error, setError] = useState(null); 9 const [data, setData] = useState('No result'); 10 11 const [on, toggle] = useTorchLight(streamRef.current); 12 13 const setRef = ({ stream }) => { 14 streamRef.current = stream; 15 }; 16 17 return ( 18 <> 19 <QrReader 20 onLoad={setRef} 21 onScan={setData} 22 onError={setError} 23 style={{ width: '100%' }} 24 /> 25 <button onClick={toggle}>{on ? 'Disable Torch' : 'Enable Torch'}</button> 26 <p>{JSON.stringify(data, null, 2)}</p> 27 <p>{JSON.stringify(error, null, 2)}</p> 28 </> 29 ); 30};
Please, open an issue following one of the issues templates. We will do our best to fix them.
If you want to contribute to this project see contributing for more information.
Distributed under the MIT license. See LICENSE for more information.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/9 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
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
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
38 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
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