Skip to content

BlockSuite API Documentation / @blocksuite/store / Space

Class: Space<State> ​

Contents ​

Extended By ​

Type parameters ​

• State extends Record<string, unknown> = Record<string, any>

Constructors ​

new Space(id, rootDoc, awarenessStore) ​

new Space<State>(id, rootDoc, awarenessStore): Space<State>

Parameters ​

• id: string

• rootDoc: BlockSuiteDoc

• awarenessStore: AwarenessStore<BlockSuiteFlags>

Returns ​

Space<State>

Source ​

packages/store/src/workspace/space.ts:31

Properties ​

_loaded ​

private _loaded: boolean

Source ​

packages/store/src/workspace/space.ts:20


_onLoadSlot ​

private _onLoadSlot: Slot<void>

Source ​

packages/store/src/workspace/space.ts:22


_yBlocks ​

protected readonly _yBlocks: Map<State[keyof State]>

Source ​

packages/store/src/workspace/space.ts:29


_ySpaceDoc ​

protected readonly _ySpaceDoc: Doc

Used for convenient access to the underlying Yjs map, can be used interchangeably with ySpace

Source ​

packages/store/src/workspace/space.ts:28


awarenessStore ​

readonly awarenessStore: AwarenessStore<BlockSuiteFlags>

Source ​

packages/store/src/workspace/space.ts:18


id ​

readonly id: string

Source ​

packages/store/src/workspace/space.ts:16


rootDoc ​

readonly rootDoc: BlockSuiteDoc

Source ​

packages/store/src/workspace/space.ts:17

Accessors ​

loaded ​

get loaded(): boolean

Returns ​

boolean

Source ​

packages/store/src/workspace/space.ts:49


spaceDoc ​

get spaceDoc(): Doc

Returns ​

Doc

Source ​

packages/store/src/workspace/space.ts:53


yBlocks ​

get yBlocks(): Map<State[keyof State]>

Returns ​

Map<State[keyof State]>

Source ​

packages/store/src/workspace/space.ts:45

Methods ​

_initSubDoc() ​

private _initSubDoc(): Doc

Returns ​

Doc

Source ​

packages/store/src/workspace/space.ts:90


_onSubdocEvent() ​

private _onSubdocEvent(__namedParameters): void

Parameters ​

• __namedParameters: Object

• __namedParameters.loaded: Set<Doc>

Returns ​

void

Source ​

packages/store/src/workspace/space.ts:107


clear() ​

clear(): void

Returns ​

void

Source ​

packages/store/src/workspace/space.ts:86


destroy() ​

destroy(): void

Returns ​

void

Source ​

packages/store/src/workspace/space.ts:80


load() ​

load(): Promise<Space<State>>

Returns ​

Promise<Space<State>>

Source ​

packages/store/src/workspace/space.ts:57


remove() ​

remove(): void

Returns ​

void

Source ​

packages/store/src/workspace/space.ts:75


transact() ​

transact(fn, shouldTransact): void

If shouldTransact is false, the transaction will not be push to the history stack.

Parameters ​

• fn: () => void

• shouldTransact: boolean= true

Returns ​

void

Source ​

packages/store/src/workspace/space.ts:122


Generated using typedoc-plugin-markdown and TypeDoc