Documentation / @super-line/client / DocHandle
Interface: DocHandle<Doc>
Defined in: index.ts:208
A reactive handle over one opened CRDT document (ADR-0007). set/update mutate the local replica and write the resulting delta through to the server, which validate-before-commits it; on rejection the server resyncs this replica.
Type Parameters
Doc
Doc = unknown
Properties
deleted
readonlydeleted:boolean
Defined in: index.ts:233
True once the server fans out a delete for this document.
ready
readonlyready:Promise<void>
Defined in: index.ts:231
Resolves once the catch-up snapshot has been applied; rejects if the open is denied or the doc is absent.
Methods
close()
close():
void
Defined in: index.ts:235
Stop receiving changes and tell the server to unsubscribe.
Returns
void
delete()
delete(
path):void
Defined in: index.ts:218
Surgically remove the value at path (merges, unlike a full-doc set); sent to the server.
Parameters
path
(string | number)[]
Returns
void
getSnapshot()
getSnapshot():
Doc|undefined
Defined in: index.ts:210
The current snapshot (undefined until the catch-up snapshot arrives).
Returns
Doc | undefined
native()
native():
unknown
Defined in: index.ts:229
The CRDT engine's own document handle, for a native root — a CRDT type bound beside the contract-described root, holding content whose merge granularity is finer than a field (collaborative text). Mutating it writes through exactly like set, and its content is invisible to the described snapshot and therefore to validation.
unknown by design: typing it would put the engine's CRDT library into @super-line/client's public surface. Narrow it with the accessor from the engine package — yDocOf(handle) from @super-line/collections-crdt-memory for the Yjs engine — which also documents the caveats.
Returns
unknown
set()
set(
data):void
Defined in: index.ts:214
Replace the document (mutates the local CRDT doc); the delta is sent to the server.
Parameters
data
Doc
Returns
void
subscribe()
subscribe(
cb): () =>void
Defined in: index.ts:212
Subscribe to changes (local writes + remote merges). Returns an unsubscribe fn.
Parameters
cb
() => void
Returns
() => void
update()
update(
partial):void
Defined in: index.ts:216
Merge a partial update; the delta is sent to the server.
Parameters
partial
Partial<Doc>
Returns
void