should use storage.local over window.localStorage
See original GitHub issueProblem
This template currently uses localStorage(1, 2).
MDN advises against using local storage because of persistence issues:
Although this API is similar to Window.localStorage it is recommended that you don’t use Window.localStorage in extension code. Firefox will clear data stored by extensions using the localStorage API in various scenarios where users clear their browsing history and data for privacy reasons, while data saved using the
storage.localAPI will be correctly persisted in these scenarios.
Proposal
Use storage.local via webextension-polyfill.
FYI VueUse useStorage accepts a 3rd parameter to accept a StoreLike object, so perhaps a wrapper around storage.local could have been passed in. However, storage.local APIs return promises so it cannot.
Because of storage.local’s async nature, it might be best to create another composable function that returns an isLoaded state.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:6 (5 by maintainers)

Top Related StackOverflow Question
@privatenumber I guess we are missing a composable to support async storage. I imagine we could have
useAsyncStoragein VueUse, and convert the storage interface fromwebextension-polyfillin this template.@privatenumber PR #58