@plasmohq/storage
@plasmohq/storage
is an utility library from plasmo that abstract away the persistent storage API available to browser extension. It fallbacks to localstorage in context where the extension storage API is not available, allowing for state sync between popup - options - contents - background.
This library will enable the storage
permission automatically if used with the Plasmo framework
Documentation
Visit: https://docs.plasmo.com/framework/storage
Firefox
To use the storage API on Firefox during development you need to add an addon ID to your manifest, otherwise, you will get this error:
Error: The storage API will not work with a temporary addon ID. Please add an explicit addon ID to your manifest. For more information see https://mzl.la/3lPk1aE.
To add an addon ID to your manifest, add this to your package.json:
"manifest": {
"browser_specific_settings": {
"gecko": {
"id": "your-id@example.com"
}
}
}
During development, you may use any ID. If you have published your extension, you can use the ID assigned by Mozilla Addons.
Usage Examples
Why?
To boldly go where no one has gone before
License
MIT 🖖 Plasmo Corp.