Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/developit/histore
π¬ 200b key-value store backed by navigation state
https://github.com/developit/histore
database history-api key-value localstorage
Last synced: 5 days ago
JSON representation
π¬ 200b key-value store backed by navigation state
- Host: GitHub
- URL: https://github.com/developit/histore
- Owner: developit
- License: apache-2.0
- Created: 2018-05-07T18:16:41.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-05-12T03:12:19.000Z (over 6 years ago)
- Last Synced: 2024-10-17T14:07:59.779Z (17 days ago)
- Topics: database, history-api, key-value, localstorage
- Language: JavaScript
- Size: 10.7 KB
- Stars: 676
- Watchers: 16
- Forks: 19
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
Histore
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](https://jsfiddle.net/developit/8Ltn29a5/)
## Usage
```js
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](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm).
## Contributing
Please read [CONTRIBUTING.md](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](https://github.com/developit/histore/releases) page.
## License
[Apache 2.0](LICENSE)