0.0.4 • Published 2 months ago

pinia-plugin-yjs v0.0.4

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

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