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>
-
For local files, IE and Edge do not have support for local storage
-
local storage can be disabled
- Chrome, Firefox, Internet Explorer, Edge, Safari and Opera
-
Use browser's native implementation if supported
-
Mirror native functionality with an object
-
Not persistent
-
Need to use
_localStorage
instead oflocalStorage
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: