Open YasarArafathAli opened 2 years ago
Have you checked out the [immediateEvents](https://idletimer.dev/docs/api/props#immediateevents)
option? That might work for you.
Otherwise, what is stopping you from just calling your onIdle
function? Something like:
const elementRef = useRef()
const onIdle = () => {
if (!isIdle()) pause()
// Do other stuff
}
const { isIdle, pause } = useIdleTimer({
onIdle
})
useEffect(() => {
elementRef.current.addEventListener('blur', handleIdle)
return () => {
elementRef.current.removeEventListener('blur', handleIdle)
}
}, [])
@YasarArafathAli
Just checking to see if this is still an issue for you. Would like to understand the use case a little better to craft the best solution.
Feature Information
Is your feature request related to a problem? Please describe.
I was working on a use case where the user FocusOuts from an editor, i want the idletimer to trigger onIdle event.
Describe the solution you'd like.
add a method to trigger events provided in the init of idle timer