Big Updated, added some tests, added comments for all functions, I forgot the rest

This commit is contained in:
Alois 2026-03-15 14:52:09 +01:00
commit 90a1059cc8
59 changed files with 1816 additions and 203 deletions

View file

@ -22,6 +22,11 @@ const StorageContext = React.createContext<StorageContextValue | undefined>(
const isIndexedDBSupported = typeof indexedDB !== "undefined";
/**
* Executes StorageProvider.
* @param props Parameter props.
* @returns unknown.
*/
export default function StorageProvider(props: { children: React.ReactNode }) {
const [storage, setStorage] = React.useState<StorageSchema>(defaults);
const storageRef = React.useRef(storage);
@ -135,6 +140,11 @@ export default function StorageProvider(props: { children: React.ReactNode }) {
);
}
/**
* Executes useStorage.
* @param none This function has no parameters.
* @returns StorageContextValue.
*/
export function useStorage(): StorageContextValue {
const context = React.useContext(StorageContext);
if (!context) {