Skip to content

BlockSuite API Documentation / @blocksuite/store / AwarenessStore

Class: AwarenessStore<Flags>

Type parameters

Flags extends Record<string, unknown> = BlockSuiteFlags

Constructors

new AwarenessStore(store, awareness, defaultFlags)

new AwarenessStore<Flags>(store, awareness, defaultFlags): AwarenessStore<Flags>

Parameters

store: Store

awareness: Awareness<RawAwarenessState<Flags>>

defaultFlags: Flags

Returns

AwarenessStore<Flags>

Source

packages/framework/store/src/yjs/awareness.ts:43

Properties

awareness

readonly awareness: Awareness<RawAwarenessState<Flags>>

Source

packages/framework/store/src/yjs/awareness.ts:36


slots

readonly slots: Object

slots.update

update: Slot<AwarenessEvent<Flags>>

Source

packages/framework/store/src/yjs/awareness.ts:39


store

readonly store: Store

Source

packages/framework/store/src/yjs/awareness.ts:37

Methods

_initFlags()

private _initFlags(defaultFlags): void

Parameters

defaultFlags: Flags

Returns

void

Source

packages/framework/store/src/yjs/awareness.ts:55


_onAwarenessChange()

private _onAwarenessChange(diff): void

Parameters

diff

diff.added: number[]

diff.removed: number[]

diff.updated: number[]

Returns

void

Source

packages/framework/store/src/yjs/awareness.ts:106


destroy()

destroy(): void

Returns

void

Source

packages/framework/store/src/yjs/awareness.ts:136


getFlag()

getFlag<Key>(field): undefined | Flags[Key]

Type parameters

Key extends string | number | symbol

Parameters

field: Key

Returns

undefined | Flags[Key]

Source

packages/framework/store/src/yjs/awareness.ts:68


getLocalSelection()

getLocalSelection(space): readonly Record<string, unknown>[]

Parameters

space: Space<Record<string, any>>

Returns

readonly Record<string, unknown>[]

Source

packages/framework/store/src/yjs/awareness.ts:98


getStates()

getStates(): Map<number, RawAwarenessState<Flags>>

Returns

Map<number, RawAwarenessState<Flags>>

Source

packages/framework/store/src/yjs/awareness.ts:102


isReadonly()

isReadonly(space): boolean

Parameters

space: Space<Record<string, any>>

Returns

boolean

Source

packages/framework/store/src/yjs/awareness.ts:81


setFlag()

setFlag<Key>(field, value): void

Type parameters

Key extends string | number | symbol

Parameters

field: Key

value: Flags[Key]

Returns

void

Source

packages/framework/store/src/yjs/awareness.ts:63


setLocalSelection()

setLocalSelection(space, selection): void

Parameters

space: Space<Record<string, any>>

selection: UserSelection

Returns

void

Source

packages/framework/store/src/yjs/awareness.ts:90


setReadonly()

setReadonly(space, value): void

Parameters

space: Space<Record<string, any>>

value: boolean

Returns

void

Source

packages/framework/store/src/yjs/awareness.ts:73