0.0.1 • Published 4 months ago

vue-crdt v0.0.1

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

📦 Install

npm i vue-crdt

🦄 Usage

import { reactive, ref } from 'vue'
import { defineStore, useHistory } from 'vue-crdt'

const useEditorStore = defineStore(doc => {
  // use y-webrtc
  //
  // new WebrtcProvider(
  //  'your-room-name',
  //  doc,
  //  { password: 'optional-room-password' },
  // )

  return {
    workspace: reactive({
      pages: { a: 'b' },
      activePage: null,
    }),
    width: ref(800),
    height: ref(600),
  }
})

const { workspace, width, height } = useEditorStore()

const history = useHistory(workspace)

workspace.activePage = 123
history.stopCapturing()
workspace.activePage = 456
history.undo()

console.log(workspace)