It should be used with caution because it is synchronous and will block the main thread. It may be useful for storing small amounts of session specific information, for example an IndexedDB key. SessionStorage is tab specific, and scoped to the lifetime of the tab. There are several other storage mechanisms available in the browser, but they have limited use and may cause significant performance issues. They're accessible from the window object, web workers, and service workers, making it easy to use them anywhere in your code. They're both asynchronous, and will not block the main thread. IndexedDB and the Cache Storage API are supported in every modern browser. For other data, use IndexedDB (with a promises wrapper).For the network resources necessary to load your app and file-based content, use the Cache Storage API (part of service workers).Here's a general recommendation for storing resources: But which is the best solution? How much can you store? How do you prevent it from being evicted? What should I use? # There are several ways to cache your static application resources (HTML, JavaScript, CSS, images, etc.), and data (user data, news articles, etc.). Even in perfect wireless environments, judicious use of caching and other storage techniques can substantially improve the user experience. Internet connections can be flakey or non-existent on the go, which is why offline support and reliable performance are common features in progressive web apps. How can I check how much storage is available?.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |