in src/pro-src/rules.js [531:554]
storeHistory(url) {
if (this.history && this.history.lastTimeInDomain) {
// https://stackoverflow.com/questions/12661293/save-and-load-date-localstorage
// This is why we parse the date stored in localStorage
const timeSinceLastSession = Date.now() - Date.parse(this.history.lastTimeInDomain);
const minutesSinceLastSession = timeSinceLastSession / (60 * 1000);
if (minutesSinceLastSession > 30) {
this.history.timesInDomain =
this.history && this.history.timesInDomain ? this.history.timesInDomain + 1 : 1;
this.history.path = [];
}
}
if (url) this.history.path.push(url);
localStorage.setItem(
LOCAL_STORAGE_ACCESS_STRING,
JSON.stringify({
path: this.history.path,
lastTimeInDomain: new Date(),
timesInDomain: (this.history && this.history.timesInDomain) || 1,
timePerPage: this.history.timePerPage,
rulesTriggered: this.history.rulesTriggered
})
);
}