
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
vue-persistedstate
Advanced tools
This plug-in is useful for state management because it is impossible to predict how a user will cache, exposing three methods: Storage createVuexPersistedState createPiniaPersistedState
# npm
npm i vue-persistedstate
# yarn
yarn add vue-persistedstate
/**
* @name: s
* @param {key:string}
* @return {value:any}
* @return {expires:number}
*/
import { Storage } from "vue-persistedstate"
let s = new Storage({source:window.sessionStorage}) //The default value is the window. The localStorage
s.set("userInfo",{uName:"zhangsan",upwd:"123456"},5000)
setInterval(()=>{
console.log(s.get('uName')) // Undefined is displayed after 5s
},1000)
The createVuexPersistedState method has four parameters
import { createVuexPersistedState } from "vue-persistedstate";
/**
* @name: createVuexPersistedState
* @param {key:string}
* @param {storage}
* @param {whiteList:Array<string>}
* @param {blackList:Array<string>}
* @return {storage}
*/
export default new Vuex.Store({
plugins: [
createVuexPersistedState({
key:'vuex',
storage:window.localStorage,
whiteList:[],
blackList: [],
}),
],
modules: {},
state: {},
mutations: {},
actions: {},
modules: {},
});
import { createPinia } from "pinia";
import { createPiniaPersistedState } from "vue-persistedstate";
const store = createPinia();
store.use(createPiniaPersistedState());
//or
store.use(createPiniaPersistedState({
key:'You want the cache key', // Default is pinia- your Module ID
storage:'The way you want to cache' // The default value is the window. The localStorage
}));
export default store;
Set whiteList in the module: Array, whiteList is empty or not set to all cache, default is all cache, whiteList can be set to cache other keys do not cache
import { defineStore } from "pinia";
const useUser = defineStore("user", {
state: () => {
return {
userName: "zhangsan",
};
},
getters: {},
actions: {},
whiteList: ["userName"], // Only userName is cached
});
export default useUser;
FAQs
state management
The npm package vue-persistedstate receives a total of 107 weekly downloads. As such, vue-persistedstate popularity was classified as not popular.
We found that vue-persistedstate demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.