Skip to content

Data Manager

Data Manager

WEB SDK Data Manager

Data Manager is responsible for managing the data operations for WEB SDK. WEB SDK loads necessary data at startup. And use them in its lifetime. But It downloads pois when it needs them. For example, If the user navigates to a new site It downloads pois for that site. Once pois for that sites are downloaded it doesn’t download them again. It uses them from local memory.

To fully refresh Web SDK’s data it is necessary to reload window.

window.location.reload();

If you need an inactivity period for a refresh:

// Refresh Rate is how often you want to refresh the page
// based on the user inactivity.
var refreshRate = 600; //<-- In seconds, change to your needs
var lastUserAction = 0;

// Reset the Timer on users last action
function reset() {
  lastUserAction = 0;
}

// Count Down that executes ever second
setInterval(function () {
  lastUserAction++;
  refreshCheck();
}, 1000);

// The code that checks if the window needs to reload
function refreshCheck() {
  var focus = window.onfocus;
  if ((lastUserAction >= refreshRate && document.readyState == "complete")) {
    window.location.reload(); // If this is called no reset is needed
    reset(); // We want to reset just to make sure the location reload is not called.
  }
}
$(document).bind("click mousemove keypress wheel gestureend touchmove touchend", reset)

Last update: October 6, 2022
Back to top