0.0.6 • Published 5 months ago

pinia-persist-share v0.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

Install

npm install pinia-persist-share

Description

Sync your Pinia state across browser tabs.Only Supports vue3, easy as shit!

Usage

// main.js
import { createApp } from "vue";
import { createPinia } from "pinia";
import App from "./App.vue";
import PiniaPersistShare from "pinia-persist-share";

const app = createApp(App);
const pinia = createPinia();

pinia.use(PiniaPersistShare);
app.use(pinia);

app.mount("#app");
// src/store/status.js
import { ref } from "vue";
import { defineStore } from "pinia";

export const useStatusStore = defineStore(
  "status",
  () => {
    const now = ref(Date.now());

    const setNow = (payload) => {
      now.value = payload;
    };

    return {
      now,
      setNow,
    };
  },
  {
    persistShare: {
      enabled: true, // enable plugin for this store
    },
  }
);
0.0.5

5 months ago

0.0.6

5 months ago

0.0.4

5 months ago

0.0.3

5 months ago

0.0.2

5 months ago

0.0.1

5 months ago