npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

vuex-state-storage-sync

v1.1.0

Published

Synchronization of vuex state and storage

Readme


🖲 Install

npm install --save vuex-state-storage-sync

🕹 Usage

For Vue 3 + Vuex 4

import { createStore } from "vuex";
import syncStateStorage from "vuex-state-storage-sync";

export default createStore({
  // ... your store options
  plugins: [
    syncStateStorage({
      storage: window.localStorage, // or window.sessionStorage
      key: "my-app", // Storage key name
      paths: ["user", "settings"], // State paths to sync
    }),
  ],
});

For Vue 2 + Vuex 3

import Vue from "vue";
import Vuex from "vuex";
import syncStateStorage from "vuex-state-storage-sync";

Vue.use(Vuex);

export default new Vuex.Store({
  // ... your store options
  plugins: [
    syncStateStorage({
      storage: window.sessionStorage,
      key: "legacy-app",
      paths: ["auth.token"],
    }),
  ],
});

⚙️ Options

| Option | Type | Default | Description | | :------------------------- | :-------- | :----------- | :------------------------------------------------------- | | storage | Storage | localStorage | Storage engine (localStorage, sessionStorage, or custom) | | key | string | "store" | Storage key name | | paths | string[] | undefined | Array of state paths to persist | | overwrite | boolean | false | If true, state is overwritten on rehydration | | fetchBeforeUse | boolean | false | Load from storage before plugin install | | getState | Function | internal | Custom get state from storage | | setState | Function | internal | Custom set state to storage | | removeState | Function | internal | Custom remove state from storage | | reducer | Function | internal | Custom reducer to select part of state | | filter | Function | internal | Mutation filter | | subscriber | Function | internal | Custom subscribe implementation | | rehydrated | Function | internal | Callback after rehydration | | merge | Function | deepmerge | Custom merge function | | arrayMerge/arrayMerger | Function | overwrite | Custom array merge logic | | assertStorage | Function | internal | Storage validation on start |

🛡 TypeScript Support

Type definitions are included, and all options are fully type-safe for use with TypeScript.

💡 Advanced Usage

Custom Remove (e.g., remove state on logout)

const plugin = syncStateStorage({
  // ...options
});

store.subscribeAction({
  after: (action) => {
    if (action.type === "user/logout") {
      plugin.removeState("my-app", window.localStorage);
    }
  },
});

Custom Storage (e.g., cookies, IndexedDB)

const customStorage = {
  getItem: (key) => /* ... */,
  setItem: (key, value) => /* ... */,
  removeItem: (key) => /* ... */
};

syncStateStorage({
  storage: customStorage,
  // ...
});

💬 Commit Message Convention

| When | Commit Message | | :----------- | :---------------------------- | | Add feature | feat: ⚡️ Add function | | Fix bug | fix: 🐞 Fix bug | | Refactor | refactor: 🛠 Refactoring | | Add package | package: 📦 Add package | | Docs change | docs: 📚 Fix readme | | Style change | style: 👁 Improvements style | | Releases | releases: 🎉 Releases |

📜 License

MIT

Made with ❤️ by AGUMON 🦖

GitHub