Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useIdle #36

Open
msuntharesan opened this issue Oct 27, 2018 · 1 comment
Open

useIdle #36

msuntharesan opened this issue Oct 27, 2018 · 1 comment

Comments

@msuntharesan
Copy link

msuntharesan commented Oct 27, 2018

Check if user is idle.

import useIdle from "@rehooks/idleMonitor"

function MyComponent() {
  const [isIdle, resume, pause] = useIdleMonitor();

  return (
    <div>
      {isIdle && <span>you are idle</span>}
      <button onClick={pause}>Pause idle monitor</button>
      <button onClick={resume}>Resume idle monitor</button>
    </div>
  );
}

I will give this a go.

@harisvsulaiman
Copy link

@VanthiyaThevan I don't know how you are tracking user idleness, I think you are going to attach a mouse listener and keyboard listener to the state.

I have a suggestion, in that case, please include a threshold for triggering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants