JSPM

pinia-plugin-yjs-enhanced

0.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q18477F
  • License MIT

pinia plugin that enables sharing of state between clients via Yjs (forked and modified from croatialu/pinia-plugin-yjs)

Package Exports

  • pinia-plugin-yjs-enhanced

Readme

pinia-plugin-yjs

npm version npm downloads bundle JSDocs License

Example

import { createPinia } from 'pinia'
import * as Y from 'yjs'
import { WebrtcProvider } from 'y-webrtc'
import { createPiniaYJSPlugin } from 'pinia-plugin-yjs'

const ydoc = new Y.Doc()

const webrtcProvider = new WebrtcProvider('roomName', ydoc, { signaling: ['ws://localhost:4444'] })
const pinia = createPinia()

pinia.use(createPiniaYJSPlugin({ doc: ydoc }))

defineStore('todo', () => {
  // xxx
  return {
    // ...
  }
}, {
  // enable sharing
  sharing: true,
})

Thanks

License

MIT License © 2023-PRESENT croatialu