Skip to main content

Crate mdcs_wasm

Crate mdcs_wasm 

Source
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§

CollaborativeDocument
A collaborative rich text document backed by CRDTs.
UserPresence
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