A browser storage solution for Procore front-end applications, providing a standardized interface for interacting with local and session storage.
You can install @procore/web-sdk-storage
via yarn:
yarn add @procore/web-sdk-storage
- Type-safe access to
localStorage
andsessionStorage
. - Accepts
react-query
-style keys for cleaner storage keys.
import { storage } from '@procore/web-sdk-storage';
const itemToSave: Item = {
some: 'data',
};
const itemKey = ['items', { companyId: 1, projectId: 2, itemId: 3 }];
storage.local.setItem(itemKey, itemToSave);
const savedItem = storage.local.getItem<Item>(itemKey);
storage.local.deleteItem(itemKey);
import { storage } from '@procore/web-sdk-storage';
const itemToSave: Item = {
some: 'data',
};
const itemKey = ['items', { companyId: 1, projectId: 2, itemId: 3 }];
storage.session.setItem(itemKey, itemToSave);
const savedItem = storage.session.getItem<Item>(itemKey);
storage.session.deleteItem(itemKey);