1.1.4 • Published 9 months ago

use-y-js v1.1.4

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

useYjs

A custom hook simplifies to create of a CRDT document.

Manual

1.Start a signaling y-websocket server

PORT=4444 npx y-websocket

Read more: y-websocket

2.Intall use-y-js

npm install use-y-js

3.Import hook and start coding

import { useYjs } from "use-y-js";
// ...
const { data, updateData, userInfoMap, updateFieldLocalUserInfo } = useYjs({
  signaling: "ws://localhost:4444",
  roomName: "your-room-name",
  // use for auth
  params: {
    token: "anthing"
  }
  // POJO
  initData: {
    title: "Doc title",
    content: "Doc content"
  },
  // POJO
  initUserInfo: {
    name: "Rio",
    color: "#166f9c",
    pointerLocation:  {
      x: 100,
      y: 200
    }
  },
  // Minimum time until the next userInfo data sync, defaultValue = 250
  intervalSyncTime: 300
});
1.1.4

9 months ago

1.1.1-alpha-8

9 months ago

1.1.1-alpha-7

9 months ago

1.1.1-alpha-6

9 months ago

1.1.1-alpha-5

9 months ago

1.1.1-alpha-4

9 months ago

1.1.1-alpha-3

9 months ago

1.1.1-alpha-2

9 months ago

1.1.1-alpha-1

9 months ago

1.1.3

9 months ago

1.1.2

9 months ago

1.1.1

9 months ago

1.1.0

9 months ago