ExclusiveStackLocalStorage Class
Like a StackLocalStorage, but only allows one store to be set at a time.
Signature
export declare class ExclusiveStackLocalStorage<T>
Example
const store = new ExclusiveStackLocalStorage({
emptyErrorMessage: 'Store is empty',
conflictErrorMessage: 'Store is already set'
})
store.run(1, () => {
console.log(store.getStore()) // 1
store.run(2, () => { ... }) // throws 'Store is already set'
})
console.log(store.getStore()) // throws 'Store is empty'
Constructors
Constructor | Description |
---|---|
(constructor)(options) | Creates a new ExclusiveStackLocalStorage. |