
Product
Socket Firewall Now Blocks Malicious VS Code and Open VSX Extensions
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.
@rooks/use-timeout
Advanced tools
npm install rooks
or
yarn add rooks
Rooks is completely treeshakeable and if you use only 1 of the 50+ hooks in the package, only that hook will be bundled with your code. Your bundle will only contain the hooks that you need. Cheers!
setTimeout hook for react.
npm install --save @rooks/use-timeout
import useTimeout from "@rooks/use-timeout"
function TimeoutComponent() {
function doAlert() {
window.alert("timeout expired!");
}
const { start, clear } = useTimeout(doAlert, 2000);
return (
<>
<button onClick={start}> Start timeout </button>
<button onClick={clear}> Clear timeout </button>
</>
);
}
render(<TimeoutComponent/>)
| Arguments | Type | Description | Default value |
|---|---|---|---|
| callback | function | Function to be executed in timeout | undefind |
| delay | Number | Number in milliseconds after which callback is to be run | 0 |
| Returned object attributes | Type | Description |
|---|---|---|
| clear | function | Clear the timeout |
| start | function | Start the timeout |
| isActive | boolean | Is the timeout active |
FAQs
A React Hooks package for timeout
The npm package @rooks/use-timeout receives a total of 1,015 weekly downloads. As such, @rooks/use-timeout popularity was classified as popular.
We found that @rooks/use-timeout demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.

Research
More than 140 Mastra npm packages were compromised in a supply chain attack that used a typosquatted dependency to deliver a cross-platform infostealer during installation.

Research
/Security News
A new npm package tests AI malware scanners with prompt injection, safety-triggering comments, context flooding, and obfuscated JavaScript.