How to make a timer in the cache?

The question is: is there a website (a lot of Strannik) how to make immediately after the first call the website started to go in the cache timer (say 60 seconds), and after the expiration of the fire div c display inline (prior to this, for example was display:none)? And that transitions between pages timer is not started to go again
April 7th 20 at 15:39
3 answers
April 7th 20 at 15:41
When you first visit the site, the script writes to localStorage (or anywhere) first visit. After start the timer, say, every second checks to see "if it took 60 seconds from the time of the first visit"

When re-entering, my first visit will continue, and it does not need to be updated. The script will again check the "if it Passed 60 seconds from the time of first visit" and modify the page properties if "Passed"
April 7th 20 at 15:43
function myFunc() {
 return 'I in cache!'
}

let cache = localStorage;

cache.timer = (function() => {
 return setTimeout(myFunc, 3000)
});

console.log(cache.timer);
how would that work? - mathias50 commented on April 7th 20 at 15:46
@Jack25, Google to help - beau.Bahring commented on April 7th 20 at 15:49
April 7th 20 at 15:45
<style>
.display-automessage {display:none;}
</style>

the <script>
if(localStorage.getItem('fistVisit'))
{

 if (localStorage.getItem('fistVisit') < Date())
{
 setTimeout(() => {
document.querySelector(".display-automessage").style.display="inline"
 }, 10);
}
}
else
{
 var date = new Date();
 date.setSeconds(date.getSeconds() + 5);
 localStorage.setItem('fistVisit', date);

 setTimeout(() => {
document.querySelector(".display-automessage").style.display="inline"
 }, 5000);
}
</script>

<div class="display-automessage">
hello
</div>

Find more questions by tags JavaScript