Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@untemps/react-vocal
Advanced tools
React component to initiate a SpeechRecognition session.
The Web Speech API is supported by Chrome only so far. On other browsers, the Vocal
component won't display anything.
yarn add @untemps/react-vocal
Import the Vocal
component:
import Vocal from '@untemps/react-vocal'
Instantiate it:
const App = () => {
const [result, setResult] = useState('')
const _onVocalStart = () => {
setResult('')
}
const _onVocalResult = (result) => {
setResult(result)
}
return (
<div className="App">
<span style={{ position: 'relative' }}>
<Vocal
onStart={_onVocalStart}
onResult={_onVocalResult}
style={{ width: 16, position: 'absolute', right: 10, top: -2 }}
/>
<input defaultValue={result} style={{ width: 300, height: 40 }} />
</span>
</div>
)
}
By default, Vocal
displays an icon with two states (idle/listening):
But you can provide your own component:
const App = () => {
const [isListening, setIsListening] = useState('')
const _onSpeechStart = () => {
setIsListening(true)
}
const _onSpeechEnd = () => {
setIsListening(false)
}
return (
<Vocal onSpeechStart={_onSpeechStart} onSpeechEnd={_onSpeechEnd}>
{isListening ? 'Waiting for vocal' : <button>Click to speech</button>}
</Vocal>
)
}
The component passed as children must respect the following constraints:
onClick
handler used to trigger the recognition session. If the component provides its own onClick
callback, it will be overridden by the Vocal component implementation.Props | Type | Default | Description |
---|---|---|---|
timeout | number | 3000 | Defines the time in ms to wait before discarding the recognition |
style | object | null | Defines the styles of the default element if className is not specified |
className | string | null | Defines the class of the default element |
onStart | func | null | Defines the handler called when the recognition starts |
onEnd | func | null | Defines the handler called when the recognition ends |
onSpeechStart | func | null | Defines the handler called when the speech starts |
onSpeechEnd | func | null | Defines the handler called when the speech ends |
onResult | func | null | Defines the handler called when a result is recognized |
onError | func | null | Defines the handler called when an error occurs |
onNoMatch | func | null | Defines the handler called when no result can be recognized |
FAQs
React component and hook to initiate a SpeechRecognition session
The npm package @untemps/react-vocal receives a total of 42 weekly downloads. As such, @untemps/react-vocal popularity was classified as not popular.
We found that @untemps/react-vocal demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.