🏬 200b key-value store backed by navigation state
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore Initial release! May 7, 2018
CONTRIBUTING.md Initial release! May 7, 2018
LICENSE Initial release! May 7, 2018
README.md Add demo link May 8, 2018
histore.js Using constants for constant variables (#5) May 12, 2018
package.json Initial release! May 7, 2018

README.md

histore

Histore npm

Histore [his·to·ry]: a 200b key-value store backed by navigation state.

Does the fact that sessionStorage/localStorage is shared across tabs have you down?

Don't worry, here's a strange but widely supported way to store 640kb of object data in a page's navigation state.

View Demo on JSFiddle

Usage

import histore from 'histore'

let storage = histore()

storage.set('foo', 'bar')
storage.get('foo')  // 'bar'

storage.set('obj', { any: 'object' })
storage.get('obj').any  // 'object'

Interestingly, due to the way history.replaceState works, storing objects will implicitly clone them using the Structured Clone algorithm.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Changelog

Every release, along with the migration instructions, is documented on the Github Releases page.

License

Apache 2.0