Make storing objects in SessionStorage easier and faster.

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

Install

Link to this version
ImportedReleased 31 December 2018MIT License
Framework Support
Browser Independent
Install with
npm install ob-session"@0.0.4"
Run the above npm command in your project folder. If you have any issues installing, please contact the author.
Release notes - Version 0.0.4

Dependencies

  • xtal-latx#0.0.86
  • idb-keyval#3.1.0