# vue-localstore

> Vue plugin for localForage.

Latest version **0.1.0** (published 2018-05-13) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install vue-localstore
pnpm add vue-localstore
yarn add vue-localstore
bun add vue-localstore
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2018-05-13 |
| First published | 2018-05-13 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 14.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Alexandre Charoy |
| Maintainers | alex-c |
| Keywords | localforage, store, local store, persistence, vue, vue plugin, vue store, vue local store |

## Links

- npm: https://www.npmjs.com/package/vue-localstore
- Repository: https://github.com/alex-c/vue-localstore
- Homepage: https://github.com/alex-c/vue-localstore#readme
- Issues: https://github.com/alex-c/vue-localstore/issues
- npm.io page: https://npm.io/package/vue-localstore

## Dependencies (1)

- [localforage](https://npm.io/package/localforage.md) ^1.7.1

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2018-05-13

## README

# vue-localstore
Vue plugin for [localForage](https://github.com/localForage/localForage). Binds localForage to Vue instances as `$localstore`.

## Installation
Install `vue-localstore` with `npm` (or alternatively `yarn`):

```bash
npm --save install vue-localstore
```

Then add it to Vue in your main.js:

```javascript
const VueLocalStore = require('vue-localstore');
Vue.use(VueLocalStore);
```

## Usage
Since `localForage` is exposed directly to `this.$localstore`, you can use both the callback-based and Promsie-based API.

```javascript
this.$localstore.setItem('key', 'value').then(function () {
    return this.$localstore.getItem('key');
}).then(function (value) {
    // we got our value
}).catch(function (err) {
    // we got an error
});
```

## Configuration
When adding `vue-localstore` to Vue, you can pass a configuration object. This causes `$localstore` to point to a configured `localForage` instance (see localForage documentation sections [Configuration](https://github.com/localForage/localForage#configuration) and [Multiple instances](https://github.com/localForage/localForage#multiple-instances)):

```javascript
const VueLocalStore = require('vue-localstore');

Vue.use(VueLocalStore, {
    driver      : localforage.WEBSQL, // Force WebSQL; same as using setDriver()
    name        : 'myApp',
    version     : 1.0,
    size        : 4980736, // Size of database, in bytes. WebSQL-only for now.
    storeName   : 'keyvaluepairs', // Should be alphanumeric, with underscores.
    description : 'some description'
});
```

---
_Source: https://npm.io/package/vue-localstore · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
