【发布时间】:2017-09-07 14:01:43
【问题描述】:
我们正在使用 Angularjs 1.5 和 Ng-Idle 模块来捕获应用程序中特定时间间隔内的用户不活动时间。如果超时达到用户根据空闲开始和空闲结束刷新用户会话,我们会显示警报窗口。当用户真正处于非活动状态时,这种方法很好,这意味着他不会滚动、鼠标单击或输入任何内容,但它不会通过简单地将鼠标移动到应用程序上来检测用户何时在屏幕上处于活动状态。有没有办法在 Ng_Idle 模块中添加额外的事件来捕获鼠标悬停,以通过更多事件来中断不活动?
Please find the code snippet, it is referred from here
http://hackedbychinese.github.io/ng-idle/
function closeModals() {
if ($scope.warning) {
$scope.warning.close();
$scope.warning = null;
//refreshing the session from server
}
if ($scope.timedout) {
$scope.timedout.close();
$scope.timedout = null;
}
}
$scope.$on('IdleStart', function() {
closeModals();
$scope.warning = $uibModal.open({
templateUrl: 'warning-dialog.html'
});
});
$scope.$on('IdleEnd', function() {
closeModals();
});
$scope.$on('IdleTimeout',
function() {
closeModals();
$scope.timedout = $uibModal.open({
templateUrl: 'timedout-dialog.html'
});
$timeout(
function() {
//logout the application
}, 72000);
});
【问题讨论】:
-
显示一些代码。到目前为止,您尝试过什么?
标签: javascript angularjs ng-idle