News for hackers. Stuff that matters.
Re:Why IndexedDB is slow and what to use instead by littlestymaar on Tuesday November 23, 2021 @07:41AM (#29317108)
> When the window fires the beforeunload event we can assume that the JavaScript process is exited any moment and we have to persist the state. After beforeunload there are several seconds time which are sufficient to store all new changes. This has shown to work quite reliable.

On the contrary, I've found onbeforeunload far from reliable (albeit my use-case was a bit different). You should probably not rely on it for anything important.

Re:Why IndexedDB is slow and what to use instead by shubik22 on Tuesday November 23, 2021 @09:20AM (#29318092)
This has been my experience as well. At a prior job, we experimented with deferring reporting/tracking functions until the browser was idle, and then firing the remaining tracking events on unload and found that a non-trivial number of events were just dropped (I believe due to this issue).
Re:Why IndexedDB is slow and what to use instead by littlestymaar on Tuesday November 23, 2021 @09:45AM (#29318354)
Funny, because that was almost exactly my use-case as well. I guess sending network requests during the onload event doesn't work well, but maybe for local things it works better, who knows.