@pluv/crdt-yjs v0.17.3
Disclaimer: This package is currently in preview and may have breaking changes between versions. Please wait for a
v1.0.0
stable release before using this in production.
@pluv/crdt-yjs
Yjs adapter for @pluv/client and @pluv/io.
👉 See full documentation on pluv.io. 👈
Installation
Note This package is already re-exported from @pluv/client, @pluv/react and @pluv/io as
y
, so you likely do not need to install this directly.
# npm
npm install @pluv/crdt-yjs yjs
# yarn
yarn add @pluv/crdt-yjs yjs
# pnpm
pnpm add @pluv/crdt-yjs yjs
Basic Example
import { createClient } from "@pluv/client";
import { yjs } from "@pluv/crdt-yjs";
import { z } from "zod";
// Import the PluvIO instance as a type from your server file
import { type io } from "./server";
const client = createClient<typeof io>({ /* client config here */ });
// Create a room to join
const room = client.createRoom("my-room", {
initialStorage: yjs.doc(() => ({
editor: yjs.xmlFragment({
children: [
yjs.xmlElement("paragraph", {
children: [yjs.xmlText("Hello World!")],
}),
]
}),
groceryList: yjs.map([
["apricots", 2],
["bread", 3],
["cheese", 5],
]),
messages: yjs.array([]),
})),
presence: z.object({}),
});
Reference
Check us out on GitHub for more information on how to use @pluv/io
.
24 days ago
25 days ago
26 days ago
2 months ago
3 months ago
3 months ago
3 months ago
3 months ago
5 months ago
5 months ago
5 months ago
5 months ago
9 months ago
9 months ago
8 months ago
8 months ago
9 months ago
7 months ago
9 months ago
6 months ago
5 months ago
9 months ago
10 months ago
10 months ago
12 months ago
1 year ago
11 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago