Reputation: 750
I need to control every tot time (es. 1h) if my token is expired. if is a make logout.
How can I launch a function that does the check every hour? something that no will stop my work so not the setTimeout ...
There is a mode to do that? as every hour the system call this function...?
Thanks
Upvotes: 0
Views: 415
Reputation: 400
Although the use case is not exactly clear, this sounds like something that ServiceWorker
s can do. You can read more about that here.
A service worker is a script that your browser runs in the background, separate from a web page, opening the door to features that don't need a web page or user interaction.
TL;DR
The idea is that you can have in the browser another "thread" ongoing, regardless of the activity of the webapp/websote which it is bound to. Something like Facebook notifications that appear even when you're not on Facebook.
If you can add more information, I'll be glad to help out and enrich this answer.
Upvotes: 1