@vyrekxd/localstorage-plus
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

LocalStorage+

A module that upgrades the base localStorage of webs, originally maked for MyPresences.

class LocalStoragePlus

new LocalStoragePlus(storage: Storage)

To instance the class you need to put your localStorage.

window.localStorage.plus = new LocalStoragePlus(window.localStorage)

get(key: string) -> object

Gets an object in localStorage with the key.

window.localStorage.plus.set('my-key', 'my-object')

const res = window.localStorage.plus.get('my-key')

/*

my-object

*/

set(key: string, value: T) -> T

Set an object in the localStorage.

window.localStorage.plus.set('my-key', 'my-object')

delete(key: string) -> void

Deletes a key on localStorage.

window.localStorage.plus.delete('my-key', 'my-object')

key(index: number) -> string

Get a key in localStorage using his index.

const res = window.localStorage.plus.key(0)

/*

my-key

*/

deleteAll() -> void

Delete all keys in localStorage.

window.localStorage.plus.deleteAll()

Properties

  • length -> Shows the quantity of elements in localStorage.

Package Sidebar

Install

npm i @vyrekxd/localstorage-plus

Weekly Downloads

1

Version

1.0.3

License

MIT

Unpacked Size

5.94 kB

Total Files

5

Last publish

Collaborators

  • vyrekxd