2.1.1 • Published 5 months ago
lesca-local-storage
Licence
—
Version
2.1.1
Deps
1
Size
7 kB
Vulns
0
Weekly
0
Why use it?
save data by base64 in local storage.
Live Demo
Installation
npm install lesca-local-storage --save
Usage
import Storage from 'lesca-local-storage';
// set any type of data
Storage.set('keyName', { anyKey: 'anyValue', name: 'anyName' });
// get data from storage
const { data, timestamp } = Storage.get('keyName');
console.log(data); //{ anyKey: 'anyValue', name: 'anyName' }
console.log(timestamp); // get milliseconds => (set data time ------> now)
Development
Methods
| method | description | return |
|---|---|---|
| .set(key:string, data:object) | set data as a key | void |
| .get(key:string) | get data as a key | void |
| .remove(key:string) | remove data by key | void |
| .clear() | clear all data | void |
Features
- maintain if necessary