background/background.js
/*
  Run initialization once when browser starts. 
*/
Run initialization once when browser starts.
Run initialization once when browser starts .
async function init() {
  _settings = await settings_get();
  var threshold = new Date();
  threshold.setDate(threshold.getDate() - _settings.track.duration);
  activity_clearEntries(threshold);
  var intervalID = setInterval(writeCacheToStorage, 15 * 60000);
  await midnightTask();
  setInterval(detectIdleUser, 60000);
}
async function init ( ) { _settings = await settings_get ( ) ; var threshold = new Date ( ) ; threshold . setDate ( threshold . getDate ( ) - _settings . track . duration ) ; activity_clearEntries ( threshold ) ; var intervalID = setInterval ( writeCacheToStorage , 15 * 60000 ) ; await midnightTask ( ) ; setInterval ( detectIdleUser , 60000 ) ; }
Run initialization once when browser starts.
Run initialization once when browser starts .
// Update local settings //Clear old entries /* 
    For test only. clear newer entries.
  */ //threshold = new Date(); //threshold.setHours(0,0,0); //activity_clearEntries(threshold, false); // Write cache to storage periodically in case of browser or OS crash // Write cache to storage at midnight // Detect if user is idle every minute //setInterval(updateBadgeText, 5000);