GitHub - mutativejs/mutative-yjs: A library for building Yjs collaborative web applications with Mutative
Briefly

GitHub - mutativejs/mutative-yjs: A library for building Yjs collaborative web applications with Mutative
"Mutative is a high-performance immutable data structure library for JavaScript. Y.js is a CRDT library with mutation-based API. mutative-yjs allows manipulating Y.js data types with the API provided by Mutative. šŸ”„ Bidirectional Sync: Seamlessly sync between Yjs CRDT types and plain JavaScript objects šŸŽÆ Immutable Updates: Use Mutative's intuitive draft-based API for state updates šŸ“¦ Type Safe: Full TypeScript support with type inference"
"import { bind } from 'mutative-yjs'. Create a binder: const binder = bind(doc.getMap("state")). Add subscription to the snapshot: binder.subscribe(listener). Mutations in Y.js data types will trigger snapshot subscriptions. Calling update(...) (similar to create(...) in Mutative) will update their corresponding Y.js types and also trigger snapshot subscriptions. Call binder.get() to get the latest snapshot. (Optionally) call binder.unbind() to release the observer. Y.Map binds to plain object {}, Y.Array binds to plain array [], and any level of nested Y.Map/ Y.Array binds to nested plain JSON object/array respectively."
Mutative-Yjs binds Y.js CRDT types to plain JavaScript objects and enables bidirectional synchronization. The library exposes Mutative's draft-based API for immutable updates while batching changes into explicit Y.js transactions. Mutations emit snapshot subscriptions and the binder API provides bind(doc.getMap("state")), binder.subscribe(listener), binder.get(), and binder.unbind(). Y.Map maps to {}, Y.Array maps to [], and nested Y.Map/Y.Array map to nested JSON. Y.XmlElement and Y.Text are not supported by default and require using Y.js top-level types or custom binding. The library emphasizes TypeScript type safety, patch-based performance, customizable patch application, reactive subscriptions, and a lightweight opt-in design.
Read at GitHub
Unable to calculate read time
[
|
]