re: Why AsyncLocalStorage instead of LocalStorage? VIEW POST


Having skimmed the code I think your promise is just running the localStorage operations inside a wrapper? That just means that they are deferred a tick rather than truly Async and only one will happen one at a time and the read/write will happen all at once. This seems to just make it slower to read and write from localStorage. I would also argue that makes it hard to know which order things will happen in and what the state of a key actually is. Would be tricky if you mixed it with your own or library code that used localStorage directly.

I love the documentation and the error message etc, I'm just not sure what the use case is as if I just wrote localStorage operations it would be faster and would block the main thread for the same amount of time.

code of conduct - report abuse