This package has been deprecated

Author message:

Please migrate to `@nuxtjs/universal-storage` (https://git.io/fjPw7)

nuxt-universal-storage
TypeScript icon, indicating that this package has built-in type declarations

0.3.1 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i nuxt-universal-storage

Weekly Downloads

38

Version

0.3.1

License

MIT

Unpacked Size

18.1 kB

Total Files

8

Last publish

Collaborators

  • farzadso
  • kevinmarrec
  • pi0