Expand description
§MDCS WebAssembly Bindings
This crate provides WebAssembly bindings for the MDCS (Merkle-Delta CRDT Store), enabling real-time collaborative editing in web browsers.
§Features
- CollaborativeDocument: Rich text document with CRDT-based conflict resolution
- UserPresence: Cursor and selection tracking for collaborative UIs
- Offline-first: All operations work locally, sync when connected
§Usage
import init, { CollaborativeDocument, UserPresence } from 'mdcs-wasm';
await init();
const doc = new CollaborativeDocument('doc-123', 'user-abc');
doc.insert(0, 'Hello, World!');
doc.apply_bold(0, 5);
console.log(doc.get_text()); // "Hello, World!"
console.log(doc.get_html()); // "<b>Hello</b>, World!"Structs§
- Collaborative
Document - A collaborative rich text document backed by CRDTs.
- Json
Document - A collaborative JSON document backed by JsonCrdt.
- Rich
Text Document - Explicit rich text wrapper for SDK-style API naming.
- Text
Document - A collaborative plain text document backed by RGAText.
- User
Presence - User presence information for collaborative UI.
Functions§
- console_
log - Log a message to the browser console.
- generate_
replica_ id - Generate a unique replica ID.
- generate_
user_ color - Generate a random user color from a preset palette.
- init_
panic_ hook