vue-electron-json-storage

A vue plugin that attaches electron-json-storage APIs to the Vue object, making them accessible to all components.
3,346 1
Install
npm install vue-electron-json-storage
Latest Version:1.0.1
License:ISC
Last Updated:Dec 29, 2016
Links: GitHub  ·  npm
Maintainer: admbradford

vue-electron-storage

A vue plugin that wraps electron-json-storage APIs to the Vue object.

js-standard-style

Installing

Install using NPM

npm install vue-electron-json-storage --save

Include using webpack or browserify

main.js

import Vue from 'vue'
import VueElectronJSONStorage from 'vue-electron-json-storage'

Vue.use(VueElectronJSONStorage)

Using the plugin

This plugin will attach electron-json-storage APIs to the Vue object itself, so accessing all APIs is dead simple. All official documentation from electron-json-storage can be used and accessed from this.$storage.

So instead of...

const storage = require('electron-json-storage')

export default {
  methods: {
    getName () {
      storage.get('name', (err, data) => {
        if (err) {
          console.error(err)
        } else {
          console.log(data)
        }
      })
    }
  }
}

Now you can...

export default {
  methods: {
    getName () {
      this.$storage.get('name', (err, data) => {
        if (err) {
          console.error(err)
        } else {
          console.log(data)
        }
      })
    }
  }
}

Now you might be thinking, "Is it really that annoying to simply require electron to access it?" Probably not, but it can get cumbersome to have to include it in every component file that needs it. In the end, attaching electron-json-storage directly to Vue just makes sense.

Related Packages

vue-electron

The vue plugin that attaches electron APIs to the Vue object, making them access...

161,317 294
hal-json-vuex

Use a HAL JSON API with Vuex

32,398 8
nuxt-jsonapi

Easy JSON:API client integration for Nuxt.js

5,760 44
vue-plugin-axios

A wrapper for integrating axios to Vuejs

3,521 5
@mudas/storage

This is a tool library that supports session Storage, local Storage, cookie, map...

883 1

Version History

Version Released License
1.0.1 ISC
1.0.0 ISC