Registry / storage / session-storage-sync

session-storage-sync

JSON →
library0.6.3jsnpmunverified

Syncs localStorage and sessionStorage across all browser tabs from the same origin. Version 0.6.3 (latest) is a maintenance-phase release with no recent updates. It is TypeScript-friendly, requiring no external type definitions, and targets AMD module loaders. Unlike native storage events which only fire in other tabs, this library provides a unified API to read/write and automatically synchronizes data across all open tabs. It is lightweight but has no active maintenance since 2019, making it suitable only for projects that accept risk of unpatched issues.

npm install session-storage-sync
INSTALL
IMPORT
SIG · SESSION-STORAGE-SY
S
session-storage-sync
storagejavascriptv0.6.3
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.

Storage
import { Storage } from 'session-storage-sync';
const Storage = require('session-storage-sync').Storage;
ES module import; CommonJS require works but must destructure `.Storage`.
default import
import { Storage } from 'session-storage-sync';
import Storage from 'session-storage-sync';
No default export; only named export `Storage` is available.
type import
import type { Storage } from 'session-storage-sync';
TypeScript types are included; use `import type` for type-only imports.

Shows basic usage: create Storage instance, set/get/remove/clear on both sessionStorage and localStorage with cross-tab synchronization.

import { Storage } from 'session-storage-sync'; const storage = new Storage(); // Set a value in sessionStorage (syncs across tabs) storage.session.set('theme', 'dark'); // Get the value const theme = storage.session.get('theme'); console.log(theme); // 'dark' // Remove a key storage.session.remove('theme'); // Clear all session storage storage.session.clear(); // Use localStorage similarly storage.local.set('preferences', JSON.stringify({ language: 'en' })); const prefs = JSON.parse(storage.local.get('preferences')); console.log(prefs.language); // 'en'
Debug
Known issues
deprecatedPackage has not been updated since 2019; no support for newer browser APIs or security fixes.
fix
Consider alternatives like `broadcast-channel` or `localStorage` native events.
affects: >=0.0.0
gotchaImport path is `session-storage-sync` not `session-storage`; may cause confusion with similar package names.
fix
Use exact import `import { Storage } from 'session-storage-sync'`.
affects: *
gotchaStorage instance must be created with `new Storage()`. Using `Storage()` without `new` will throw a TypeError.
fix
Always use `new Storage()`.
affects: *
breakingPackage is built for AMD module loader; as-is, it may not work with CommonJS or ESM environments without recompilation.
fix
Recompile TypeScript with desired module target (e.g., `commonjs` or `es2015`) using `tsc --module commonjs`.
affects: 0.x
Errors
Common errors & fixes
Uncaught ReferenceError: exports is not defined
AMD module output used in a non-AMD environment (e.g., Node.js or ESM script).
fix
Recompile TypeScript with `module: commonjs` or use a bundler that supports AMD.
TypeError: Storage is not a constructor
Missing `new` keyword when instantiating Storage.
fix
Change `const storage = Storage();` to `const storage = new Storage();`
Cannot find module 'session-storage-sync'
Package not installed or import path incorrect.
fix
Run `npm install session-storage-sync` and ensure import path matches package name.
Upgrade
Version history
0.6.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
18 hits · last 30 days
node
16
Amazon
1
Resources
session-storage-sync — npm install session-storage-sync · libregistry