Small package to help you check whether user is idle or active.
react-activity-detector π΄
Activity detector is a package which makes it simple to track if your user is still idle or active.
Install
$ npm install --save react-activity-detector
How to use
Basic example
importActivityDetectorfrom'react-activity-detector';constcustomActivityEvents=['click','keydown',];constsignOut=()=>{console.log("The user is loged out");}<ActivityDetectoractivityEvents={customActivityEvents}isActive={true}timeout={5*1000}signOut={signOut}/>
Parameter options
isActive: Boolean value indicating if the AD is active or not.
timeout time in milliseconds which will trigger signOut
activityEvents: events used to detect if the user is active or not. Default list of Activity Events is ['click', 'mousemove', 'keydown', 'DOMMouseScroll', 'mousewheel', 'mousedown', 'touchstart', 'touchmove', 'focus']. If none event is sent the listβ¦
Happy hacktoberfest everyone π±βπ
For all those who need to track users idleness on their ReactJS apps, feel free to contribute
filipjelic / react-activity-detector
Small package to help you check whether user is idle or active.
react-activity-detectorπ΄
Activity detector is a package which makes it simple to track if your user is still idle or active.
Install
How to use
Basic example
Parameter options
isActive
: Boolean value indicating if the AD is active or not.timeout
time in milliseconds which will triggersignOut
activityEvents
: events used to detect if the user is active or not. Default list of Activity Events is['click', 'mousemove', 'keydown', 'DOMMouseScroll', 'mousewheel', 'mousedown', 'touchstart', 'touchmove', 'focus']
. If none event is sent the listβ¦