redux-storage-engine-jsurl
v1.0.2
Published
jsurl engine for redux-store. Store your state in the url hash.
Downloads
45
Maintainers
Readme
redux-storage-engine-jsurl
Store your state as url hash via redux-storage and jsurl
With this engine, you allow your users to share their application state via the URL.
It stores your passed state in the window.location.hash
property using window.pushState()
. With jsurl the stored state after the fragment identifier is kind of human readable.
The main purpose of this project is to give developers of small and simple redux based apps the option that users can share their app state with others without having to implement a router.
Install
npm install --save redux-storage-engine-jsurl
Usage
Just use it as any other redux-storage engine.
This projects provides a ES2015 modules variant using the modules
in the package.json
.
Also it supplies variants for node v0.10, v4 and v6. They are required dynamically to avoid breaking changes when supporting new LTS versions in the future.
// ES2015 module syntax:
import createEngine from 'redux-storage-engine-jsurl'
// In case your loader does not support the package.json module entry:
import createEngine from 'redux-storage-engine-jsurl/dist/es-modules'
// Old CommonJS variant:
const createEngine = require('redux-storage-engine-jsurl')
const engine = createEngine()
The ES2015 modules variant is fully transpiled to ES5 except for the import/export syntax to support tools like UglifyJS2.
Options
There are no options to set. I recommend to combine the engine with redux-storage-decorator-filter and redux-storage-decorator-debounce
to store only parts of your state in the url and avoid spamming window.pushState()
.
Development
This project follows the standard coding and the conventional changelog commit message style. Also it is configured to never decrease the code coverage of its tests.
Also make sure you check out all available npm scripts via npm run
.
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue. But before doing anything, please read the CONTRIBUTING.md guidelines.