Skip to content
localStorage polyfill, relies on cookies instead
JavaScript HTML
Branch: master
Clone or download
wouterlucas Rename to localCookie.js, add force cookies option.
- Align class + filename to repository name
- Allow options to specificy whether we should force cookies (useful for
the tests).
- Update test to test localStorage and Cookies all in 1 go.
Latest commit e3fbd02 Oct 25, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist
module Rename to localCookie.js, add force cookies option. Oct 25, 2019
src Rename to localCookie.js, add force cookies option. Oct 25, 2019
test Rename to localCookie.js, add force cookies option. Oct 25, 2019
.gitignore Initial commit of localCookie Oct 22, 2019
LICENSE Initial commit of localCookie Oct 22, 2019
index.html Initial commit of localCookie Oct 22, 2019
package-lock.json Initial commit of localCookie Oct 22, 2019
package.json Initial commit of localCookie Oct 22, 2019
readme.md Rename to localCookie.js, add force cookies option. Oct 25, 2019
rollup.config.js Rename to localCookie.js, add force cookies option. Oct 25, 2019

readme.md

localCookies

A tiny localStorage shim with fallback to Cookies. Will allow apps to use localStorage but fallsback to cookies when that is not available in the browser.

About localCookies

The localCookies library has the exact same API as localStorage, for more information see here.

localCookies comes in two flavors a iife function that can be directly used in the <script> tag under ./dist and a ES6 module under ./module

Getting started

localCookies can be directly imported from the dist or module folder. For development:

npm install github:WebPlatformForEmbedded/localCookies
// or
yarn add github:WebPlatformForEmbedded/localCookies

Next you can import the localCookies dependency into your own script and start implementing it from there.

import Storage from './module/localCookie.js',
// or
const Storage = require('./module/localCookie.js')

Build

To build a new dist or module from source execute: npm run build

Running tests

This library has unit / integration tests, located in the tests folder.

To run all the tests execute: npm test

This will run rollup, start a http-server with mocha/chai and run the tests in a browser.

You can’t perform that action at this time.