- Installation
- Getting started
- Methods for LocalStorage and SessionStorage
- Cookie methods
- Contributing
You need to install package.
npm install combo-storage
You should import the required storage to use the package
import { LocalStorage, SeessionStorage, Cookie } from 'combo-storage'
Then use the methods of storage. For example:
LocalStorage.set('user', 'awibox');
Method | LocalStorage | SessionStorage |
---|---|---|
set | LocalStorage.set(key, value) |
SessionStorage.set(key, value) |
get | LocalStorage.get(key) |
SessionStorage.get(key) |
remove | LocalStorage.remove(key) |
SessionStorage.remove(key) |
сlear | LocalStorage.clear() |
SessionStorage.clear() |
Note: get and set methods are available for working with objects and arrays.
Method | Example |
---|---|
set | Cookie.set(name, value, days); |
get | Cookie.get(name) |
remove | Cookie.remove(name) |
Please read through our CONTRIBUTING.md.