JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 9
  • Score
    100M100P100Q46567F
  • License MIT

Just localStorage with memory fallback. Works in edge cases like Safari private browsing.

Package Exports

  • just-storage

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (just-storage) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

just-storage

Just localStorage with a memory fallback.

Just a simple localStorage module that not checks for not only the existance of localStorage, but also checks that localStorage is enabled in the current session.

This implementation works in cases like Safari private browsing, where every call to localStorage throws a quota exceeded error.

Also does simple JSON stringify/parse for you, as well.

Install

$ npm install --save just-storage

Usage

var storage = require('just-storage')

storage('key', { some: 'value' }) // ==> saves { some: 'value' }
storage('key') // ==> { some: 'value' }

API

justStorage(key, [value]) -> value

key

Required Type: string

The key to save or load from storage.

value

Optional Type: string

If provided, will save value under key. If not provided, will load key and return its value.

License

MIT © Andrew Joslin