SupremeTechnopriest / react-idle-timer

User activity timer component
https://idletimer.dev
MIT License
1.15k stars 143 forks source link

Before Unload cancel #285

Closed Daneng66 closed 2 years ago

Daneng66 commented 2 years ago

Question

Could the idle timer potentially be affected by a cancelling of a browser beforeUnload notification, my implementations appears to stop working. (in Chrome)

sadashivm commented 2 years ago

Even I'm also facing the same issue. I have implemented before unload event. Display message when user try to close a tab with the help of before unload event listerner.

After adding this event, the react idle timer always giving isLeader() true If I open another tab. But If I disable this onBefore unload event code, then it is working as I expected. Like isLeader() method return false when open another tab.

I request to developer @SupremeTechnopriest please provide a solution to handle unload event listerner as well isLeader() method should return false if user open another tab.

SupremeTechnopriest commented 2 years ago

Closing this in favor of #291 which has more detail.