UNPKG

next-shared-state

Version:

Enhanced state sharing for Next.js with IndexedDB persistence and URL data transfer between pages and components.

15 lines (14 loc) 346 B
// src/memoryStore.ts const globalStore = {}; export function setMemory(key, value) { globalStore[key] = value; } export function getMemory(key) { return globalStore[key]; } export function clearMemory(key) { if (key) delete globalStore[key]; else Object.keys(globalStore).forEach((k) => delete globalStore[k]); }