Skip to content

BlockSuite API Documentation / @blocksuite/sync / IndexedDBDocSource

Class: IndexedDBDocSource

Defined in: doc/impl/indexeddb.ts:35

Implements

Constructors

new IndexedDBDocSource()

new IndexedDBDocSource(dbName): IndexedDBDocSource

Defined in: doc/impl/indexeddb.ts:45

Parameters

dbName

string = DEFAULT_DB_NAME

Returns

IndexedDBDocSource

Properties

channel

channel: BroadcastChannel

Defined in: doc/impl/indexeddb.ts:37


dbName

readonly dbName: string = DEFAULT_DB_NAME

Defined in: doc/impl/indexeddb.ts:45


dbPromise

dbPromise: null | Promise<IDBPDatabase<BlockSuiteBinaryDB>> = null

Defined in: doc/impl/indexeddb.ts:39


mergeCount

mergeCount: number = 1

Defined in: doc/impl/indexeddb.ts:41


name

name: string = 'indexeddb'

Defined in: doc/impl/indexeddb.ts:43

for debug

Implementation of

DocSource.name

Methods

getDb()

getDb(): Promise<IDBPDatabase<BlockSuiteBinaryDB>>

Defined in: doc/impl/indexeddb.ts:47

Returns

Promise<IDBPDatabase<BlockSuiteBinaryDB>>


pull()

pull(docId, state): Promise<null | { data: Uint8Array; state: Uint8Array<ArrayBufferLike>; }>

Defined in: doc/impl/indexeddb.ts:56

Parameters

docId

string

state

Uint8Array

Returns

Promise<null | { data: Uint8Array; state: Uint8Array<ArrayBufferLike>; }>

Implementation of

DocSource.pull


push()

push(docId, data): Promise<void>

Defined in: doc/impl/indexeddb.ts:78

Parameters

docId

string

data

Uint8Array

Returns

Promise<void>

Implementation of

DocSource.push


subscribe()

subscribe(cb): () => void

Defined in: doc/impl/indexeddb.ts:103

Subscribe to updates from peer

Parameters

cb

(docId, data) => void

callback to handle updates

Returns

Function

unsubscribe function

Returns

void

Implementation of

DocSource.subscribe