3 ms·
> If you ever had to port localStorage based code to IndexedDB you have been confronted to Javascript's biggest flaw; its asynchronous system is leaky. Once you
by Touche 13y ago
> If you ever had to port localStorage based code to IndexedDB you have been confronted to Javascript's biggest flaw; its asynchronous system is leaky. Once you have an asynchronous method, every other method that calls it must be asynchronous as well.
If I was writing localStorage I would use setTimeout or something and make it async from the beginning. You should always assume async when any type of I/O is happening.
- fvdessen 13y agoYes In deed, but I think it is very unfortunate that JavaScript forces you to make your code more complex than it needs to just because the API might change in the future :/