BlockSuite API Documentation / @blocksuite/store / DocCollection
Class: DocCollection
Extends
DocCollectionAddonType
Constructors
new DocCollection()
new DocCollection(
__namedParameters
):DocCollection
Parameters
__namedParameters
Returns
Overrides
DocCollectionAddonType.constructor
Defined in
packages/framework/store/src/store/collection.ts:131
Properties
_schema
protected
readonly
_schema:Schema
Defined in
packages/framework/store/src/store/collection.ts:82
awarenessStore
readonly
awarenessStore:AwarenessStore
<BlockSuiteFlags
>
Defined in
packages/framework/store/src/store/collection.ts:84
awarenessSync
readonly
awarenessSync:AwarenessEngine
Defined in
packages/framework/store/src/store/collection.ts:86
blobSync
readonly
blobSync:BlobEngine
Defined in
packages/framework/store/src/store/collection.ts:88
blockCollections
readonly
blockCollections:Map
<string
,BlockCollection
>
Defined in
packages/framework/store/src/store/collection.ts:90
doc
readonly
doc:BlockSuiteDoc
Defined in
packages/framework/store/src/store/collection.ts:92
docSync
readonly
docSync:DocEngine
Defined in
packages/framework/store/src/store/collection.ts:94
exportJSX()
exportJSX: (
blockId
?,docId
?) =>JSXElement
Parameters
blockId?
string
docId?
string
Returns
JSXElement
Inherited from
DocCollectionAddonType.exportJSX
Defined in
packages/framework/store/src/store/addon/type.ts:4
id
readonly
id:string
Defined in
packages/framework/store/src/store/collection.ts:96
idGenerator
readonly
idGenerator:IdGenerator
Defined in
packages/framework/store/src/store/collection.ts:98
importDocSnapshot()
importDocSnapshot: (
json
,docId
) =>Promise
<void
>
Parameters
json
unknown
docId
string
Returns
Promise
<void
>
Inherited from
DocCollectionAddonType.importDocSnapshot
Defined in
packages/framework/store/src/store/addon/type.ts:6
meta
meta:
DocCollectionMeta
Defined in
packages/framework/store/src/store/collection.ts:100
slots
slots:
object
docAdded
docAdded:
Slot
<string
>
docCreated
docCreated:
Slot
<string
>
docRemoved
docRemoved:
Slot
<string
>
docUpdated
docUpdated:
Slot
<void
>
Defined in
packages/framework/store/src/store/collection.ts:102
Y
static
Y:__module
Defined in
packages/framework/store/src/store/collection.ts:80
Accessors
docs
Get Signature
get docs():
Map
<string
,BlockCollection
>
Returns
Map
<string
, BlockCollection
>
Defined in
packages/framework/store/src/store/collection.ts:109
isEmpty
Get Signature
get isEmpty():
boolean
Returns
boolean
Defined in
packages/framework/store/src/store/collection.ts:113
schema
Get Signature
get schema():
Schema
Returns
Defined in
packages/framework/store/src/store/collection.ts:127
Methods
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
Defined in
packages/framework/store/src/store/collection.ts:209
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
id
string
query
Returns
Defined in
packages/framework/store/src/store/collection.ts:218
dispose()
dispose():
void
Returns
void
Defined in
packages/framework/store/src/store/collection.ts:237
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
Defined in
packages/framework/store/src/store/collection.ts:245
getBlockCollection()
getBlockCollection(
docId
):null
|BlockCollection
Parameters
docId
string
Returns
null
| BlockCollection
Defined in
packages/framework/store/src/store/collection.ts:251
getDoc()
getDoc(
docId
,options
?):null
|Doc
Parameters
docId
string
options?
Returns
null
| Doc
Defined in
packages/framework/store/src/store/collection.ts:256
removeDoc()
removeDoc(
docId
):void
Parameters
docId
string
Returns
void
Defined in
packages/framework/store/src/store/collection.ts:261
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
Defined in
packages/framework/store/src/store/collection.ts:279
start()
start():
void
Start the data sync process
Returns
void
Defined in
packages/framework/store/src/store/collection.ts:290
waitForGracefulStop()
waitForGracefulStop(
abort
?):Promise
<void
>
Wait for all data has been successfully saved to the primary storage.
Parameters
abort?
AbortSignal
Returns
Promise
<void
>
Defined in
packages/framework/store/src/store/collection.ts:299
waitForSynced()
waitForSynced():
Promise
<unknown
>
Returns
Promise
<unknown
>
Defined in
packages/framework/store/src/store/collection.ts:303