2.0.1 • Published 10 months ago

locastore v2.0.1

Weekly downloads
12
License
MIT
Repository
github
Last release
10 months ago

locastore

A localStorage wrapper that falls back to memory in private browsing mode.

install

  • npm install locastore

use

const store = require('locastore')()

OR

import Locastore from "locastore"
const store = new Locastore()

api

var store = new Locastore([namespace])

namespace is a string to prefix to each key.

store.get(key)

Retrieve a key. If localStorage.getItem() fails, falls back to memory store.

store.set(key, value)

Store a key in memory and with localStorage.setItem().

store.delete(key)

Removes a key from memory and localStorage.removeItem().

store.clear()

Removes all items from memory and localStorage within the namespace.

Locastore.clear()

Removes all items from memory and localStorage.

similar projects

license

(c) 2023 Kyle Robinson Young. MIT License

2.0.1

10 months ago

2.0.0

10 months ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.0

8 years ago

1.0.0

8 years ago