sean3z/angular-activity-monitor

inactive event is does not firing at all.

basit-fcm opened this issue · 2 comments

following is my code. let me know where i am doing wrong. because as far user perform activity it work fine and logs numbers as i did. but once it reached 0 it should print message but it is not behaving good in that. looking like inactive event is not being triggered. please help!

ActivityMonitor.off('inactive.userStatus');
            ActivityMonitor.off('activity.userStatus');

            // interval = $interval(function() {
            //   scope.state.countdown--;
            //   // console.log(scope.state.countdown);
            //   if (!scope.state.countdown) {
            //     $interval.cancel(interval);
            //   }

            // }, 1000);

            ActivityMonitor.on('inactive.userStatus', function() {
                console.log(scope.state.countdown);
                console.log('You\'re inactive!');
            });

            ActivityMonitor.on('activity.userStatus', function() {
              scope.state.countdown = timeout;
              console.log(scope.state.countdown);
            });

@basit-fcm Thanks for the issue! What version of Angular are you using?
Also, why are you using .off() then .on()?

Closing due to inactivity and inability to reproduce.