0

Im trying to create a session timeout when the user is idle for 1 min. I'm planning to use tap event from the topmost page, page-router-outlet (tap)="globalTap()" and reset the timer whenever this tap event is fired. Also, i think i'll add all the user events like swipe, double tap etc. to reset the timer.

Is this the best approach to this problem? Are there sideffects on catching global events on the page router outlet?

Similar question, Detect App inactivity/idle timeout in NativeScript, but Im not keen on the solution because its for android only and it seems like a patch for me.

eyese7en
  • 63
  • 7
  • First of all, you might not receive any event on Page / Router Outlet level when a child component inside it is tapped and have its own event listener, at least on Android. Also adding too many event listeners just to detect inactivity is not a wise idea. The native way of doing it by extending activity (Android) / app delegate (iOS) just like in the thread you linked, should be the most viable solution here. – Manoj Mar 05 '19 at 10:59
  • @Manoj thanks for your answer. Just have some follow up questions. how to do that in angular? Also, can i call a service within the onUserInteraction method? – eyese7en Mar 08 '19 at 11:15

0 Answers0