. Angular 1.3 https://github.com/HackedByChinese/ng-idle:
(function() {
angular.module('myApp', ['ngIdle'])
.controller('ctrl', homeController)
.config(function(IdleProvider, KeepaliveProvider) {
IdleProvider.idle(5);
IdleProvider.timeout(5);
KeepaliveProvider.interval(2);
})
.run(function(Idle) {
Idle.watch();
});
function homeController($scope, Idle) {
$scope.message = 'Check browser console to get idle info';
$scope.events = [];
$scope.$on('IdleStart', function() {
console.log('Idle Start');
});
$scope.$on('IdleWarn', function(e, countdown) {
console.log(e, countdown);
});
$scope.$on('IdleTimeout', function() {
console.log('Idle Timeout');
});
$scope.$on('IdleEnd', function() {
console.log('Idle End');
});
$scope.$on('Keepalive', function() {
console.log('Keep me Alive');
});
}
}());