0.0.8 • Published 6 years ago
storage-dao v0.0.8
storage-DAO
a data access object that wraps the storage api
download
npm i storage-daoor
yarn add storage-daoimport
module:
import WebStorage from 'storage-dao';browser:
<script src="../dist/webStorage.js"></script>Usage
const LS = new WebStorage({
preId: 'Grewer__',
});
export default LSconfig
| attribute | must | default | desc |
|---|---|---|---|
| preId | yes | - | pre key id |
| timeSign | no | '-' | The interval between the timestamp and the true value in value |
| type | no | 'localStorage' | localStorage or sessionStorage |
| encrypt | no | btoa | Encryption method |
| decrypt | no | atob | Decryption method |
| timeGap | no | 12 hour | Value expiration time |
methods typing
interface IResult {
status: number
key: string
value: string | null
}
{
set: (key: string, value: string, time?: string | number) => IResult
get: (key: string) => IResult
remove: (key: string) => { status: number, value: null | string }
}Change Log
- 1.0.0 : official release
- version < 1.0.0 : developing