Skip to content

BlockSuite API Documentation / @blocksuite/store / AwarenessStore

Class: AwarenessStore<Flags> ​

Contents ​

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/store/src/yjs/awareness.ts:40

Properties ​

awareness ​

readonly awareness: Awareness<RawAwarenessState<Flags>>

Source ​

packages/store/src/yjs/awareness.ts:33


slots ​

readonly slots: Object

Type declaration ​

update ​

update: Slot<AwarenessEvent<Flags>>

Source ​

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


store ​

readonly store: Store

Source ​

packages/store/src/yjs/awareness.ts:34

Methods ​

_initFlags() ​

private _initFlags(defaultFlags): void

Parameters ​

• defaultFlags: Flags

Returns ​

void

Source ​

packages/store/src/yjs/awareness.ts:52


_onAwarenessChange() ​

private _onAwarenessChange(diff): void

Parameters ​

• diff: Object

• diff.added: number[]

• diff.removed: number[]

• diff.updated: number[]

Returns ​

void

Source ​

packages/store/src/yjs/awareness.ts:99


destroy() ​

destroy(): void

Returns ​

void

Source ​

packages/store/src/yjs/awareness.ts:129


getFlag() ​

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

Type parameters ​

• Key extends string | number | symbol

Parameters ​

• field: Key

Returns ​

undefined | Flags[Key]

Source ​

packages/store/src/yjs/awareness.ts:65


getLocalSelection() ​

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

Returns ​

readonly Record<string, unknown>[]

Source ​

packages/store/src/yjs/awareness.ts:91


getStates() ​

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

Returns ​

Map<number, RawAwarenessState<Flags>>

Source ​

packages/store/src/yjs/awareness.ts:95


isReadonly() ​

isReadonly(space): boolean

Parameters ​

• space: Space<Record<string, any>>

Returns ​

boolean

Source ​

packages/store/src/yjs/awareness.ts:78


setFlag() ​

setFlag<Key>(field, value): void

Type parameters ​

• Key extends string | number | symbol

Parameters ​

• field: Key

• value: Flags[Key]

Returns ​

void

Source ​

packages/store/src/yjs/awareness.ts:60


setLocalSelection() ​

setLocalSelection(selection): void

Parameters ​

• selection: Record<string, unknown>[]

Returns ​

void

Source ​

packages/store/src/yjs/awareness.ts:87


setReadonly() ​

setReadonly(space, value): void

Parameters ​

• space: Space<Record<string, any>>

• value: boolean

Returns ​

void

Source ​

packages/store/src/yjs/awareness.ts:70


Generated using typedoc-plugin-markdown and TypeDoc