# vue-wstorage

> Vuejs local/sesion storage

Latest version **1.0.0** (published 2020-02-07) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2020-02-07 |
| First published | 2020-02-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 7.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | WAAVI |
| Maintainers | adrianhurt |
| Keywords | vue, vuejs, vue-wstorage, localstorage, sessionstorage, storage |

## Links

- npm: https://www.npmjs.com/package/vue-wstorage
- Repository: https://github.com/Waavi/vue-wstorage
- Homepage: https://waavi.com
- Issues: https://github.com/Waavi/vue-wstorage/issues
- npm.io page: https://npm.io/package/vue-wstorage

## Dependencies (1)

- [babel-preset-es2015](https://npm.io/package/babel-preset-es2015.md) ^6.24.1

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2020-02-07

## README

<br>
<br>
<br>
<p align="center">
    <img src="https://waavi.com/img/waavi_logo.4213ffb7.png" alt="WStorage by WAAVI" width="200"/>
    <br>
Vue WStorage
</p>

## Introduction

**Vue WStorage** is a library to manage localStorage and sessionStorage of your browser.

## Install

  ``` bash
  npm install vue-wstorage --save
  ```
  or
  ``` bash
  yarn add vue-wstorage
  ```

## Install

  ``` js
  import VueWStorage from 'vue-wstorage'

  Vue.use(VueWStorage)
  // Or you can specify any other name and use it via this.$ls, this.$whatEverYouWant
  Vue.use(VueWStorage, {
    name: 'ls',
    key: 'app:0.0.1',
    storage: 'local', // Select session|local storage. By default it's 'local'
  })
  ```

## Usage

  - Global instance

  ```js
  // Use localStorage from object
  Vue.storage.set('user', { name: 'Foo', surname: 'Demo' })
  Vue.storage.get('user')

  // Get all values
  Vue.storage.get()
  // Fallback value if nothing found in localStorage
  Vue.storage.get('propertyThatNotExists', 'fallbackValue') // Will return 'fallbackValue' string

  // Remove value
  Vue.storage.remove('user')
  // Remove all values
  Vue.storage.clean()
  ```

  - Local instance

  ```js
  import VueWStorage from 'vue-wstorage'

  const storage = VueWStorage.initalize()
  storage.set('user', { name: 'Foo'})
  storage.get('user')

  storage.local.set('todos', [])
  storage.session.set('step', 1)
  ```

  - Component

  ``` js
  var vm = new Vue({
    methods: {
      handleUser () {
        this.$storage.set('loading', true)
        this.$storage.get('user')
        this.$storage.remove('loading')
      }
    }
  })
  ```
## License
  MIT Licensed | Copyright © 2019-present Waavi Studio S.L.

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