Registry / storage / presentation-storage

presentation-storage

JSON →
library2.5.7jsnpmunverified

Augmented.js presentation storage module providing LocalStorage and NamespacedLocalStorage for client-side data persistence. Version 2.5.7 offers a factory pattern (LocalStorageFactory) to create storage instances with optional namespacing. It wraps native localStorage with a simple API (getItem, setItem, removeItem, clear, key, length) and browser support detection. Unlike raw localStorage, it provides namespaced storage to avoid key collisions. Release cadence is low, tied to the Augmented.js project. The library is lightweight with minimal dependencies.

npm install presentation-storage
INSTALL
IMPORT
SIG · PRESENTATION-STORA
P
presentation-storage
storagejavascriptv2.5.7
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

LocalStorageFactory
import { LocalStorageFactory } from 'presentation-storage'
const { LocalStorageFactory } = require('presentation-storage')
CommonJS require is supported only if the package is used in a CommonJS environment; defaults to ESM.
LocalStorage
import { LocalStorage } from 'presentation-storage'
import LocalStorage from 'presentation-storage'
LocalStorage is a named export, not default.
NamespacedLocalStorage
import { NamespacedLocalStorage } from 'presentation-storage'
const NamespacedLocalStorage = require('presentation-storage').NamespacedLocalStorage
Named import preferred; ensure bundler supports CommonJS interop.

Shows how to create both persistent and non-persistent, namespaced storage instances, set/get/remove items, and use getNamespacedItems.

import { LocalStorageFactory } from 'presentation-storage'; const storage = LocalStorageFactory.getStorage(true, 'myapp'); // Check support if (storage.isSupported()) { storage.setItem('user', { name: 'John' }); const user = storage.getItem('user'); console.log(user); // { name: 'John' } storage.removeItem('user'); console.log(storage.length); // 0 } const namespacedStorage = LocalStorageFactory.getStorage(false, 'namespace'); namespacedStorage.setItem('key', 'value'); console.log(namespacedStorage.getNamespacedItems()); // { key: 'value' }
Debug
Known issues
breakingLocalStorageFactory.getStorage with namespace returns NamespacedLocalStorage, not plain LocalStorage. The API methods are identical but behavior differs (keys are prefixed).
fix
When using namespace, use getNamespacedItems() to retrieve all items within the namespace; clear() only clears within the namespace.
affects: >=2.0.0
deprecatedThe second parameter 'persist' in getStorage() has no effect in browser environments; localStorage is always persistent.
fix
Ignore the persist parameter or set it to true for consistency.
affects: >=2.0.0
gotchaclear() on a non-namespaced LocalStorage clears ALL localStorage data for the origin, not just items stored via this library.
fix
Only use clear() on namespaced instances or be aware of destructive behavior.
affects: >=2.0.0
Errors
Common errors & fixes
Cannot read properties of undefined (reading 'isSupported')
LocalStorageFactory.getStorage() may return undefined if localStorage is not supported or not available.
fix
Check the return value before calling methods: const storage = LocalStorageFactory.getStorage(true); if (storage) { ... }
Uncaught TypeError: storage.getItem is not a function
Incorrect import or the package version is incompatible with the import syntax.
fix
Use named imports: import { LocalStorageFactory } from 'presentation-storage'; then call factory method.
Upgrade
Version history
2.5.7latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
21 hits · last 30 days
node
20
OpenAI (training)
1
Resources
presentation-storage — npm install presentation-storage · libregistry