1.0.3 • Published 3 years ago

@vyrekxd/localstorage-plus v1.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

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.