0.3.1 • Published 5 years ago

nuxt-universal-storage v0.3.1

Weekly downloads
33
License
MIT
Repository
github
Last release
5 years ago

Nuxt Universal Storage Module

npm (scoped with tag) npm CircleCI Codecov Dependencies js-standard-style

Universal Storage Utilities for Nuxt.js based on @nuxt-community/auth-module

📖 Release Notes

Setup

  • Add nuxt-universal-storage dependency using yarn or npm to your project
yarn add nuxt-universal-storage

OR

npm install nuxt-universal-storage --save
  • Add nuxt-universal-storage to modules section of nuxt.config.js
{
  modules: [
    'nuxt-universal-storage',
  ],

  storage: {

  }
}

Usage

Options

Options are defined as following:

 storage: {
  vuex, // boolean or {namespace} 
  localStorage, // boolean or {prefix } 
  cookie, // boolean or {prefix, options } 
  initialState,  // Object {}
  ignoreExceptions // 
 }

and default to

 {
  vuex: {
    namespace: 'storage'
  },
  cookie: {
    prefix: '',
    options: {
      path: '/'
    }
  },
  localStorage: {
    prefix: ''
  },
  ignoreExceptions: false,
}

Api

  • $storage.getUniversal(key)
  • $storage.setUniversal(key, value)
  • $storage.syncUniversal(key, defaultValue)
  • $storage.removeUniversal(key)
  • $storage.getState(key)
  • $storage.setState(key, value)
  • $storage.removeState(key)
  • $storage.watchState(key, fn)
  • $storage.getLocalStorage(key)
  • $storage.setLocalStorage(key, value)
  • $storage.removeLocalStorage(key)
  • $storage.getCookies()
  • $storage.getCookie(key)
  • $storage.setCookie(key, value)
  • $storage.removeCookie(key)

Development

  • Clone this repository
  • Install dependencies using yarn install or npm install
  • Start development server using yarn run dev or npm run dev
  • Point your browser to http://localhost:3000

Roadmap

  • Add Encryption
  • Complete Documents
  • Universal Session Handling

License

MIT License - Alibaba Travels Co

0.3.1

5 years ago

0.3.0

5 years ago

0.2.1

5 years ago

0.2.0

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.0.1

6 years ago