mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-16 09:36:17 +08:00
chore: merge blocksuite source code (#9213)
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
export interface DocSource {
|
||||
/**
|
||||
* for debug
|
||||
*/
|
||||
name: string;
|
||||
|
||||
pull(
|
||||
docId: string,
|
||||
state: Uint8Array
|
||||
):
|
||||
| Promise<{ data: Uint8Array; state?: Uint8Array } | null>
|
||||
| { data: Uint8Array; state?: Uint8Array }
|
||||
| null;
|
||||
push(docId: string, data: Uint8Array): Promise<void> | void;
|
||||
|
||||
/**
|
||||
* Subscribe to updates from peer
|
||||
*
|
||||
* @param cb callback to handle updates
|
||||
* @param disconnect callback to handle disconnect, reason can be something like 'network-error'
|
||||
*
|
||||
* @returns unsubscribe function
|
||||
*/
|
||||
subscribe(
|
||||
cb: (docId: string, data: Uint8Array) => void,
|
||||
disconnect: (reason: string) => void
|
||||
): Promise<() => void> | (() => void);
|
||||
}
|
||||
Reference in New Issue
Block a user