Skip to content

BlockSuite API Documentation / @blocksuite/store / DocCollection

Class: DocCollection

Extends

  • DocCollectionAddonType

Constructors

new DocCollection(options)

new DocCollection(options): DocCollection

Parameters

options: DocCollectionOptions

Returns

DocCollection

Overrides

DocCollectionAddonType.constructor

Source

packages/framework/store/src/store/collection.ts:36

Properties

_schema

protected readonly _schema: Schema

Source

packages/framework/store/src/store/collection.ts:26


_store

protected _store: Store

Source

packages/framework/store/src/store/collection.ts:24


blob

blob: BlobManager

Inherited from

DocCollectionAddonType.blob

Source

packages/framework/store/src/store/addon/type.ts:8


exportJSX()

exportJSX: (blockId?, docId?) => JSXElement

Parameters

blockId?: string

docId?: string

Returns

JSXElement

Inherited from

DocCollectionAddonType.exportJSX

Source

packages/framework/store/src/store/addon/type.ts:14


importDocSnapshot()

importDocSnapshot: (json, docId) => Promise<void>

Parameters

json: unknown

docId: string

Returns

Promise<void>

Inherited from

DocCollectionAddonType.importDocSnapshot

Source

packages/framework/store/src/store/addon/type.ts:13


indexer

indexer: Indexer

Inherited from

DocCollectionAddonType.indexer

Source

packages/framework/store/src/store/addon/type.ts:10


meta

meta: DocCollectionMeta

Source

packages/framework/store/src/store/collection.ts:28


search: (query) => Map<string, string>

Parameters

query: QueryContent

Returns

Map<string, string>

Inherited from

DocCollectionAddonType.search

Source

packages/framework/store/src/store/addon/type.ts:11


slots

slots: object

docAdded

docAdded: Slot<string>

docRemoved

docRemoved: Slot<string>

docUpdated

docUpdated: Slot<void>

Source

packages/framework/store/src/store/collection.ts:30


Y

static Y: Y

Source

packages/framework/store/src/store/collection.ts:23

Accessors

awarenessStore

get awarenessStore(): AwarenessStore<BlockSuiteFlags>

Returns

AwarenessStore<BlockSuiteFlags>

Source

packages/framework/store/src/store/collection.ts:68


awarenessSync

get awarenessSync(): AwarenessEngine

Returns

AwarenessEngine

Source

packages/framework/store/src/store/collection.ts:92


doc

get doc(): BlockSuiteDoc

Returns

BlockSuiteDoc

Source

packages/framework/store/src/store/collection.ts:76


docSync

get docSync(): DocEngine

Returns

DocEngine

Source

packages/framework/store/src/store/collection.ts:88


docs

get docs(): Map<string, BlockCollection>

Returns

Map<string, BlockCollection>

Source

packages/framework/store/src/store/collection.ts:72


id

get id(): string

Returns

string

Source

packages/framework/store/src/store/collection.ts:46


idGenerator

get idGenerator(): IdGenerator

Returns

IdGenerator

Source

packages/framework/store/src/store/collection.ts:80


isEmpty

get isEmpty(): boolean

Returns

boolean

Source

packages/framework/store/src/store/collection.ts:50


schema

get schema(): Schema

Returns

Schema

Source

packages/framework/store/src/store/collection.ts:84


store

get store(): Store

Returns

Store

Source

packages/framework/store/src/store/collection.ts:64

Methods

_bindDocMetaEvents()

private _bindDocMetaEvents(): void

Returns

void

Source

packages/framework/store/src/store/collection.ts:113


_hasDoc()

private _hasDoc(docId): boolean

Parameters

docId: string

Returns

boolean

Source

packages/framework/store/src/store/collection.ts:96


canGracefulStop()

canGracefulStop(): void

Verify that all data has been successfully saved to the primary storage. Return true if the data transfer is complete and it is secure to terminate the synchronization operation.

Returns

void

Source

packages/framework/store/src/store/collection.ts:192


createDoc()

createDoc(options): Doc

By default, only an empty doc will be created. If the init parameter is passed, a surface, note, and paragraph block will be created in the doc simultaneously.

Parameters

options= {}

options.id?: string

options.selector?: BlockSelector

Returns

Doc

Source

packages/framework/store/src/store/collection.ts:142


forceStop()

forceStop(): void

Terminate the data sync process forcefully, which may cause data loss. It is advised to invoke canGracefulStop before calling this method.

Returns

void

Source

packages/framework/store/src/store/collection.ts:207


getBlockCollection()

getBlockCollection(docId): null | BlockCollection

Parameters

docId: string

Returns

null | BlockCollection

Source

packages/framework/store/src/store/collection.ts:108


getDoc()

getDoc(docId, selector): null | Doc

Parameters

docId: string

selector: BlockSelector= defaultBlockSelector

Returns

null | Doc

Source

packages/framework/store/src/store/collection.ts:100


removeDoc()

removeDoc(docId): void

Parameters

docId: string

Returns

void

Source

packages/framework/store/src/store/collection.ts:168


setDocMeta()

setDocMeta(docId, props): void

Update doc meta state. Note that this intentionally does not mutate doc state.

Parameters

docId: string

props: Partial<DocMeta>

Returns

void

Source

packages/framework/store/src/store/collection.ts:160


start()

start(): void

Start the data sync process

Returns

void

Source

packages/framework/store/src/store/collection.ts:183


waitForGracefulStop()

waitForGracefulStop(abort?): Promise<void>

Wait for all data has been successfully saved to the primary storage.

Parameters

abort?: AbortSignal

Returns

Promise<void>

Source

packages/framework/store/src/store/collection.ts:199


waitForSynced()

waitForSynced(): Promise<unknown>

Returns

Promise<unknown>

Source

packages/framework/store/src/store/collection.ts:212