ideas icon indicating copy to clipboard operation
ideas copied to clipboard

useIdle

Open msuntharesan opened this issue 6 years ago • 1 comments

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.

msuntharesan avatar Oct 27 '18 00:10 msuntharesan

@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.

harisvsulaiman avatar Oct 29 '18 15:10 harisvsulaiman