A micro library for saving data in the hashStore.
npm install hash-storeA micro library for saving data in the hashStore.
It serializes an object into a string and keeps it at the URL hash fragment.
Install the package and save it as a dependency:
``npm install -s hash-store`
Import it to your js file:
`import * as HashStore from 'hash-store';`
And instanciate the service:
`const hashStore = new HashStore.default();`
Using CDN:
``
Or hosted on your premises:
``
Please be sure to update the path according to your folder structure.
Instinciate the hashStore object at the begining of your .js code:
``
const HashStore = window.HashStore.default;
const hashStore = new HashStore();
The syntax for adding data item to the storage:
`hashStore.setItem('myData', {data: 'string, number, array or an object'});`
Where myData is the key, and the second argument is actual data.
The syntax for reading the hashStore item:
`const cat = hashStore.getItem('myData');`
The syntax for removing the hashStore item:
`hashStore.removeItem('myData');`
The syntax for removing all the hashStore items:
`hashStore.clear();`
npm install`$3
`npm test`$3
`npm run build`$3
`npm run publish:npm``