Make storing objects in SessionStorage easier and faster.
File size of all components combined
The ob-session package contains three refeences to make storing objects in SessionStorage easier and faster:
- A small "api" that enhances the sessionStorage.setItem, sessionStorage.getItem and sessionStorage.removeItem calls to support storing objects, not just strings, in a performant way. Objects are stored in a global cache for rapid retrieval, but a stringified version is stored in sessionStorage for when the page is refreshed.
- A non-visual web component, "ob-session-watch", that watches for sessionStorage changes, and fires an event when such a thing happens. It can watch for all changes, or to those with a specified key.
- A non-visual web component, "ob-session-update", that updates sessionStorage declaratively.
Why focus on Session Storage?
Whereas one could argue that local storage is being eclipsed by helper libraries based on Indexed DB, session storage serves a particular niche -- In some lines of business, caching business data in the client, even after the browser closes, runs afoul of audits. history.state and sessionStorage don't appear to raise such concerns.
Install the Polymer-CLI
First, make sure you have the Polymer CLI and npm (packaged with Node.js) installed. Run
npm install to install your element's dependencies, then run
polymer serve to serve your element locally.
Viewing Your Element
$ polymer serve
Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.
- MIT License
- Browser Independent