Giter Site home page Giter Site logo

lgd8981289 / vuex-persistedstate Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 0.0 363 KB

Persist and rehydrate your Vuex state between page reloads.

Home Page: https://www.npmjs.com/package/vuex-plugin-persistedstate

License: MIT License

TypeScript 95.01% JavaScript 4.99%
vuex vuex-persistedstate vuex-plugin vuex-plugin-persistedstate

vuex-persistedstate's Introduction

vuex-persistedstate

Persist and rehydrate your Vuex state between page reloads.

robinvdvleuten/vuex-persistedstate Maintenance has stopped, but a lot of developers are still using vuex-persistedstate , so we try to replace it。

will try to keep the same API to achieve risk-free replacement.


Install

npm install --save vuex-plugin-persistedstate

The UMD build is also available on unpkg:

<script src="https://unpkg.com/vuex-plugin-persistedstate/dist/index.js"></script>

Usage

import { createStore } from "vuex";
import createPersistedState from "vuex-plugin-persistedstate";

const store = createStore({
  // ...
  plugins: [createPersistedState()],
});

Compatible with vuex 3 && vuex 4

Examples

Check out a basic example on CodeSandbox.

Edit vuex-persistedstate

Options

export interface Options<State> {
  /**
   * localStorage saved key
   */
  key: string
  /**
   * cached module name
   * Do not pass means cache all
   * pass only the specified cache
   */
  paths: string[]
  /**
   * storage
   */
  storage: Storage
  /**
   * Whether to prefetch data
   */
  fetchBeforeUse: boolean
  /**
   * Default method of prefetching data
   */
  fetchBeforeUseFn: (key: string, storage: Storage) => any
}

License

The MIT License (MIT). Please see License File for more information.

vuex-persistedstate's People

Contributors

lgd8981289 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.