bearnithi / bn-ng-idle

Angular user idle detector service
28 stars 11 forks source link

startWatching() creates new instance of idle timer on every call #43

Open SnehalJoshi1509 opened 2 years ago

SnehalJoshi1509 commented 2 years ago

In our app we have a feature of read mode and edit mode. When user starts editing something we start the idle timer by calling startWatching() and if the user is idle for specified seconds, we stop the timer with stopTimer() in subscribe callback and make it read mode. But when the user starts editing again we start the idle timer again with startWatching(). But now when the idle timeout happens the subscribe callback of startWatching() is called twice.

So if startWatching() is called n times, then n number of idle timer instances are created and all the subscribe callbacks are called.

It is expected that only 1 instance is available at any given time.

bearnithi commented 2 years ago

Hi @SnehalJoshi1509 ,

are you still facing this issue?