Directory

← Back

ob-session

Make storing objects in SessionStorage easier and faster.

Author

Contributors

Rating

ob-session

Published on webcomponents.org

File size of all components combined

The ob-session package contains three refeences to make storing objects in SessionStorage easier and faster:

  1. 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.
  2. 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.
  3. 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

Running Tests

WIP

Compatibility

(Loading compatibility data...)

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.

Version

Dependencies

  • xtal-latx#0.0.86
  • idb-keyval#3.1.0
Released
2018-12-31
Maturity
IMPORTED
License
MIT License

Compatibility

Framework
Browser
Browser Independent
Online