ANGULARJS detect inactive angularjs - Net-Raft.com

Welcome aboard! We are happy you are here and wish you good net-raft!




Just a Web Code Solution
join us

detect inactive user using angularjs


 1353

Show ResultANGULARJS


2

<!DOCTYPE html>
<html ng-app="Detect_Inactive">
<head>
<script src="//code.angularjs.org/snapshot/angular.min.js"></script>
</head>

<body>
</body>

<script>

var app = angular.module('Detect_Inactive', []);
app.run(function($rootScope, $timeout, $document) {

// Timeout timer value
var TimeOutTimerValue = 5000;

// Start a timeout
var TimeOut_Thread = $timeout(function(){ LogoutByTimer() } , TimeOutTimerValue);
var bodyElement = angular.element($document);

/// Keyboard Events
bodyElement.bind('keydown', function (e) { TimeOut_Resetter(e) });
bodyElement.bind('keyup', function (e) { TimeOut_Resetter(e) });

/// Mouse Events
bodyElement.bind('click', function (e) { TimeOut_Resetter(e) });
bodyElement.bind('mousemove', function (e) { TimeOut_Resetter(e) });
bodyElement.bind('DOMMouseScroll', function (e) { TimeOut_Resetter(e) });
bodyElement.bind('mousewheel', function (e) { TimeOut_Resetter(e) });
bodyElement.bind('mousedown', function (e) { TimeOut_Resetter(e) });

/// Touch Events
bodyElement.bind('touchstart', function (e) { TimeOut_Resetter(e) });
bodyElement.bind('touchmove', function (e) { TimeOut_Resetter(e) });

/// Common Events
bodyElement.bind('scroll', function (e) { TimeOut_Resetter(e) });
bodyElement.bind('focus', function (e) { TimeOut_Resetter(e) });

function LogoutByTimer()
{

alert('you are idle!');

}

function TimeOut_Resetter(e)
{

/// Stop the pending timeout
$timeout.cancel(TimeOut_Thread);

/// Reset the timeout
TimeOut_Thread = $timeout(function(){ LogoutByTimer() } , TimeOutTimerValue);

}

})
</script>

</html>


By        
The power of the user (%)
14%



The most helpful ANGULARJS solutions

How to get client ip address using angularjs ?How to get client ip address using angularjs ?ANGULARJS

Click to see more ...

  20.5K     3K

How to get city from ip address with angularjs ?How to get city from ip address with angularjs ?ANGULARJS

Click to see more ...

  8.2K     1.4K

how to get client machine name and user name using angularjs ?how to get client machine name and user name using angularjs ?ANGULARJS

Click to see more ...

  13.2K     796

How to get local client ip address using angularjs ?How to get local client ip address using angularjs ?ANGULARJS

Click to see more ...

  6.2K     571

get client country using angularjs ?get client country using angularjs ?ANGULARJS

Click to see more ...

  3.1K     477

get region angularjsget region angularjsANGULARJS

Click to see more ...

  3.1K     414

How to get value from a href using angularjs ?How to get value from a href using angularjs ?ANGULARJS

Click to see more ...

  2.3K     369

how to fill a list from an another file in json format using angularjs ?how to fill a list from an another file in json format using angularjs ?ANGULARJS

Click to see more ...

  2.3K     352

How to move the value of checkbox to an html element in angular.js ?How to move the value of checkbox to an html element in angular.js ?ANGULARJS

Click to see more ...

  2.8K     203

get client time zone using angularjs get client time zone using angularjs ANGULARJS

Click to see more ...

  2.4K     201

Welcome aboard!
We are happy you are here and
wish you good net-raft!