TabId and focus properties have been added to events (#254)

main
Boris Sekachev 7 years ago committed by Nikita Manovich
parent 4387fdaf46
commit 287047a00e

@ -16,10 +16,12 @@ var UserActivityHandler = function()
this.updateTimer = function() this.updateTimer = function()
{ {
let now = Date.now(); if (document.hasFocus()) {
let diff = now - this._prevEventTime; let now = Date.now();
this._prevEventTime = now; let diff = now - this._prevEventTime;
this._workingTime += diff < this._TIME_TRESHHOLD ? diff : 0; this._prevEventTime = now;
this._workingTime += diff < this._TIME_TRESHHOLD ? diff : 0;
}
}; };
this.resetTimer = function() this.resetTimer = function()
@ -52,6 +54,7 @@ class LogCollection extends Array {
var LoggerHandler = function(applicationName, jobId) var LoggerHandler = function(applicationName, jobId)
{ {
this._application = applicationName; this._application = applicationName;
this._tabId = Date.now().toString().substr(-6);
this._jobId = jobId; this._jobId = jobId;
this._username = null; this._username = null;
this._userActivityHandler = null; this._userActivityHandler = null;
@ -129,6 +132,8 @@ var LoggerHandler = function(applicationName, jobId)
application: this._application, application: this._application,
task: this._jobId, task: this._jobId,
userid: this._username, userid: this._username,
tabid: this._tabId,
focus: document.hasFocus()
}); });
}; };

Loading…
Cancel
Save