Simple Storage Manager
Simple HTML5 storage management (local storage and session storage)
install
$ npm install --save storage-mgmt# or $ yarn add storage-mgmt
Usage
// use local storage // storage setstrLocal // storage getstrLocal //--------// // use session storage // storage setstrSession // storage getstrSession
Methods
strLocal.set(key, val) | strSession.set(key, val)
data save or overwrite.
Params
key
Type: string
storage key
val
Type: boolean | string | number | object<string, string | number | boolean> | Array<Array<string | number | boolean>>
save or overwrite data.
Return
this
example
strLocal // pipestrLocal
strLocal.get(key) | strSession.get(key)
read storage data.
Params
key
Type: string
storage key
Return
boolean | string | number | object<string, string | number | boolean> | Array<Array<string | number | boolean>> | null
example
strLocal const flg = strLocal // -> trueconst data = strLocal // -> null
strLocal.remove(key) | strSession.remove(key)
delete specific data.
Params
key
Type: string
storage key
Return
this
example
strLocal strLocalconst flg = strLocal // -> null // pipe strLocalconst data = strLocal // -> null
strLocal.clear() | strSession.clear()
storage all delete.
Note that even necessary data may be deleted.