I need to update localstorage at start of the every day, which will contain a large value populated by an API.
Since the value is large, this needs to be done at once only, preferably at the start of the day when the application is active and then cache the value in localstorage for rest of the day.
I came across setInterval solution which will monitor the clock and will hit API at 12 AM and cache the value in the localstorage. But interval seems costly. Also, it may be possible that the application is not active/running at 12 AM on the client which can miss the API call.
Any ideas how this can be done?