Welcome aboard! We are happy you are here and wish you good net-raft!
<!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>
The most helpful ANGULARJS solutions
How to get client ip address using angularjs ?ANGULARJS
Click to see more ...
20.6K
3K
How to get city from ip address with angularjs ?ANGULARJS
Click to see more ...
8.3K
1.4K
how to get client machine name and user name using angularjs ?ANGULARJS
Click to see more ...
13.3K
796
How to get local client ip address using angularjs ?ANGULARJS
Click to see more ...
6.3K
571
get client country using angularjs ?ANGULARJS
Click to see more ...
3.2K
477
get region angularjsANGULARJS
Click to see more ...
3.1K
414
How to get value from a href using angularjs ?ANGULARJS
Click to see more ...
2.4K
369
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 ?ANGULARJS
Click to see more ...
2.8K
203
get client time zone using angularjs ANGULARJS
Click to see more ...
2.5K
201