A typed, usable storage API for Web Extensions that wraps chrome.storage.local. Current version 3.1.0 (stable), released monthly. It provides StorageItem for single values and StorageItemMap for maps, with type safety, default values, and change listeners. Smaller than alternatives like webextension-polyfill's storage API, and avoids the boilerplate of native chrome.storage calls. ESM only.
npm install webext-storageNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a typed StorageItem for user options with default value, demonstrates get/set and change listener.
Use import syntax and ensure your project is configured for ESM (e.g., type: module in package.json).
Update constructor calls: new StorageItem(key, { area, defaultValue }) instead of new StorageItem(key, defaultValue, area).Use .delete() to explicitly remove a key, or set to null if you want to store null.
Access previous value by storing it externally before the change, or use native chrome.storage.onChanged which provides both new and old values.
Watch for breaking changes when upgrading minor versions.
Add "type": "module" to your package.json or rename file to .mjs.
Use: import { StorageItem } from 'webext-storage'Ensure your code runs only in extension contexts (background, popup, options, content scripts) and that the 'storage' permission is declared in manifest.json.
No dependency data recorded yet.