BlockSuite API Documentation / @blocksuite/sync / DocSource
Interface: DocSource
Defined in: doc/source.ts:1
Properties
name
name:
string
Defined in: doc/source.ts:5
for debug
Methods
pull()
pull(
docId,state):null|Promise<null| {data:Uint8Array;state:Uint8Array<ArrayBufferLike>; }> | {data:Uint8Array;state:Uint8Array<ArrayBufferLike>; }
Defined in: doc/source.ts:7
Parameters
docId
string
state
Uint8Array
Returns
null | Promise<null | { data: Uint8Array; state: Uint8Array<ArrayBufferLike>; }> | { data: Uint8Array; state: Uint8Array<ArrayBufferLike>; }
push()
push(
docId,data):void|Promise<void>
Defined in: doc/source.ts:14
Parameters
docId
string
data
Uint8Array
Returns
void | Promise<void>
subscribe()
subscribe(
cb,disconnect):Promise<() =>void> | () =>void
Defined in: doc/source.ts:24
Subscribe to updates from peer
Parameters
cb
(docId, data) => void
callback to handle updates
disconnect
(reason) => void
callback to handle disconnect, reason can be something like 'network-error'
Returns
Promise<() => void> | () => void
unsubscribe function