
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
react-user-focus
Advanced tools
react-user-focus is a Reactjs component that communicates the state of the user's focus (focused, idle, away). The purpose of this component is to allow user-dependent processes such as animations, and communication to be aware of the current state of the user's focus.
The easiest way to use react-user-focus is to install it from NPM or Yarn and include it in your own React build process (using Browserify, Webpack, etc).
npm install react-user-focus --save
or
yarn add react-user-focus
react-user-focus can contain children, or be rendered simply by itself.
import ReactUserFocus from 'react-user-focus';
<ReactUserFocus
onFocusChange={onFocusChange}
onIdleChange={onIdleChange}
idleTime={2}
/>
react-user-focus currently has 3 properties can that can be included when rendering the component.
import ReactUserFocus from 'react-user-focus';
function onFocusChange(isHidden) {
console.log(`Is hidden?:${isHidden}`);
}
<ReactUserFocus
onFocusChange={onFocusChange}
/>
onIdleChange - accepts a function that is called with the parameter of isIdle when the idleness of a user changes.
idleTime - the amount of time (in seconds) with no engagement to consider a user as idle.
import ReactUserFocus from 'react-user-focus';
function onIdleChange(isIdle) {
console.log(`Is Idle?:${isIdle}`);
}
<ReactUserFocus
onIdleChange={onIdleChange}
idleTime={2}
/>
Live demo - To see a live demo of this component, visit my website: SeanKilgarriff.com. Open up the console in developer tools, and type AmIFocused?() into the console.
To build the examples locally, run:
npm install
npm start
Then open localhost:8080 in a browser. If you have other webpack dev servers running, the ports will be incremental - 8081, 8082, etc.
This repository is covered by the MIT License
Copyright (c) 2016 Sean Kilgarriff.
FAQs
react-user-focus
We found that react-user-focus 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.