local-storage-poorlyfill

1.3.0 • Public • Published

local-storage-poorlyfill

example workflow Known Vulnerabilities js-standard-style semantic-release

In-memory polyfill for local storage

Add to your project:

npm i local-storage-poorlyfill

<script type="text/javascript" src="node_modules/local-storage-poorlyfill/dist/local-storage-poorlyfill.js"></script>
<script>
// use _localStorage
</script>

Why?

  • For local files, IE and Edge do not have support for local storage

  • local storage can be disabled

Tested browsers

  • Chrome, Firefox, Internet Explorer, Edge, Safari and Opera

Implementation details

  • Use browser's native implementation if supported

  • Mirror native functionality with an object

Implementation flaws

  • Not persistent

  • Need to use _localStorage instead of localStorage

Scripts

Lint with standard:

yarn lint

Transpile with babel:

yarn build

Run unit tests:

yarn test

Use _localStorage or window._localStorage instead of localStorage or window.localStorage because the browser prevents using localStorage or window.localStorage if access is denied for this document.

W3 Spec:

MSDN:

Dependencies (0)

    Dev Dependencies (20)

    Package Sidebar

    Install

    npm i local-storage-poorlyfill

    Weekly Downloads

    0

    Version

    1.3.0

    License

    MIT

    Unpacked Size

    25.2 kB

    Total Files

    14

    Last publish

    Collaborators

    • patkub