mirror of https://github.com/keeweb/keeweb.git
fix #290: idle timer on computer sleep
This commit is contained in:
parent
bd30f84f4c
commit
f10fd3172e
|
@ -1,20 +1,25 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var Backbone = require('backbone'),
|
const Backbone = require('backbone');
|
||||||
AppSettingsModel = require('../models/app-settings-model');
|
const AppSettingsModel = require('../models/app-settings-model');
|
||||||
|
|
||||||
var IdleTracker = {
|
let IdleTracker = {
|
||||||
idleMinutes: 0,
|
idleTimeout: 0,
|
||||||
init: function() {
|
init: function() {
|
||||||
setInterval(this.minuteTick.bind(this), 1000 * 60);
|
this.scheduleLock();
|
||||||
},
|
},
|
||||||
minuteTick: function() {
|
scheduleLock() {
|
||||||
if (++this.idleMinutes === AppSettingsModel.instance.get('idleMinutes')) {
|
let idleMinutes = AppSettingsModel.instance.get('idleMinutes');
|
||||||
Backbone.trigger('user-idle');
|
if (this.idleTimeout) {
|
||||||
|
clearTimeout(this.idleTimeout);
|
||||||
}
|
}
|
||||||
|
this.idleTimeout = setTimeout(this.triggerIdle, idleMinutes * 60 * 1000);
|
||||||
},
|
},
|
||||||
regUserAction: function() {
|
triggerIdle() {
|
||||||
this.idleMinutes = 0;
|
Backbone.trigger('user-idle');
|
||||||
|
},
|
||||||
|
regUserAction() {
|
||||||
|
this.scheduleLock();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,8 @@ Release notes
|
||||||
`+` option to preload default config and file
|
`+` option to preload default config and file
|
||||||
`+` save displayed table columns
|
`+` save displayed table columns
|
||||||
`-` fix app redraw in background
|
`-` fix app redraw in background
|
||||||
`-` fix unicode auto-type on mac and linux
|
`-` fix unicode auto-type on mac and linux
|
||||||
|
`-` fix idle timer on computer sleep
|
||||||
|
|
||||||
##### v1.2.4 (2016-07-20)
|
##### v1.2.4 (2016-07-20)
|
||||||
`+` digital signature in installer
|
`+` digital signature in installer
|
||||||
|
|
Loading…
Reference in New Issue