Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
pinia-nuxt-persist
Advanced tools
Readme
It supports customer service sessionstorage, localstorage and service cookies, and can permanently store nuxtjs Pinia status data in customized storage
client
and server
storagekey
storage
Default cookiepaths
You can select one or more specifiednpm i pinia-nuxt-persist @pinia/nuxt
or yarn add pinia-nuxt-persist @pinia/nuxt
add pinia-nuxt-persist
to modules, nuxt.config.ts:
import { defineNuxtConfig } from 'nuxt3'
export default defineNuxtConfig({
modules: [
'pinia-nuxt-persist',
'@pinia/nuxt',
]
})
app.vue
<div>
{{ store.cookieCounter }}
{{ store.doubleCookieCounter }}
</div>
<button @click="store.addCookieCounter()">Cookie Add++</button>
<ClientOnly>
<div>
{{ store.localStorageCounter }}
{{ store.doubleLocalStorageCounter }}
</div>
<button @click="store.addLocalStorageCounter()">LocalStorage Add++</button>
<div>
{{ store.sessionStorageCounter }}
{{ store.doubleSessionStorageCounter }}
</div>
<button @click="store.addSessionStorageCounter()">SessionStorage Add++</button>
</ClientOnly>
stores/counter.ts
import { defineStore } from 'pinia'
export const useCounterStore = defineStore({
id: 'counter',
// Extended configuration
persist: {
// Enable cache
enabled: true,
strategies: [
{
key: 'cookieCounter', // The default key is the ID of the above store. You can customize the key
storage: 'cookie', // Default cookie
paths: ['cookieCounter'], // You can select multiple
},
{
key: 'localStorageCounter', // The default key is the ID of the above store. You can customize the key
storage: 'localStorage', // Default cookie
paths: ['localStorageCounter'], // You can select multiple
},
{
key: 'sessionStorageCounter', // The default key is the ID of the above store. You can customize the key
storage: 'sessionStorage', // Default cookie
paths: ['sessionStorageCounter'], // You can select multiple
}
]
},
state: () => ({
cookieCounter: 0,
localStorageCounter: 0,
sessionStorageCounter: 0,
}),
getters: {
doubleCookieCounter: (state) => state.cookieCounter * 2,
doubleLocalStorageCounter: (state) => state.localStorageCounter * 2,
doubleSessionStorageCounter: (state) => state.sessionStorageCounter * 2,
},
actions: {
addCookieCounter() {
this.cookieCounter++
},
addLocalStorageCounter() {
this.localStorageCounter++
},
addSessionStorageCounter() {
this.sessionStorageCounter++
}
}
})
npm run dev:prepare
to generate type stubs.npm run dev
to start playground in development mode.FAQs
Pinia's nuxt3 sustainable storage plug-in
The npm package pinia-nuxt-persist receives a total of 0 weekly downloads. As such, pinia-nuxt-persist popularity was classified as not popular.
We found that pinia-nuxt-persist 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.