Create areas that don't affect the default areas
jacksteamdev opened this issue · 1 comments
Is your feature request related to a problem? Please describe.
It would be nice to be able to create distinct areas in addition to local
and sync
. For example, a state
area used only for extension state management.
Describe the solution you'd like
import { createArea } from '@bumble/storage'
const state = createArea('state', 'local')
State has all the methods and props that a classic storage area has, but behaves as if it is it's own area. state.get
only returns values stored in the state area. state.set
likewise only affects state area. state.valueStream
only fires for changes in the state area.
Calls to chrome.storage.local.get
should not return the values for the state area, so this will require a polyfill. New areas will not create new areas on chrome.storage
.
This can be done by creating hashed keys for the new area, and filtering them out of the classic area results, and vice versa.
This is resolved with getBucket
.