Skip to content

API > @blocksuite/store > AwarenessStore

Class: AwarenessStore<Flags> ​

Constructors ​

constructor ​

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

Type parameters ​

ParameterDefault
Flags extends Record< string, unknown >BlockSuiteFlags

Parameters ​

ParameterType
storeStore
awarenessAwareness< RawAwarenessState< Flags > >
defaultFlagsFlags

Returns ​

AwarenessStore< Flags >

Defined In ​

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

Properties ​

awareness ​

readonly awareness: Awareness< RawAwarenessState< Flags > >

Defined In ​

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


slots ​

readonly slots: object

Type declaration ​

slots.update ​

update: Slot< AwarenessEvent< Flags > >

Defined In ​

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


store ​

readonly store: Store

Defined In ​

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

Methods ​

_initFlags ​

private _initFlags(defaultFlags): void

Parameters ​

ParameterType
defaultFlagsFlags

Returns ​

void

Defined In ​

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


_onAwarenessChange ​

private _onAwarenessChange(diff): void

Parameters ​

ParameterType
diffobject
diff.addednumber[]
diff.removednumber[]
diff.updatednumber[]

Returns ​

void

Defined In ​

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


destroy ​

destroy(): void

Returns ​

void

Defined In ​

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


getFlag ​

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

Type parameters ​

Parameter
Key extends string | number | symbol

Parameters ​

ParameterType
fieldKey

Returns ​

undefined | Flags[Key]

Defined In ​

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


getLocalSelection ​

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

Returns ​

readonly Record< string, unknown >[]

Defined In ​

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


getStates ​

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

Returns ​

Map< number, RawAwarenessState< Flags > >

Defined In ​

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


isReadonly ​

isReadonly(space): boolean

Parameters ​

ParameterType
spaceSpace< Record< string, any > >

Returns ​

boolean

Defined In ​

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


setFlag ​

setFlag<Key>(field, value): void

Type parameters ​

Parameter
Key extends string | number | symbol

Parameters ​

ParameterType
fieldKey
valueFlags[Key]

Returns ​

void

Defined In ​

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


setLocalSelection ​

setLocalSelection(selection): void

Parameters ​

ParameterType
selectionRecord< string, unknown >[]

Returns ​

void

Defined In ​

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


setReadonly ​

setReadonly(space, value): void

Parameters ​

ParameterType
spaceSpace< Record< string, any > >
valueboolean

Returns ​

void

Defined In ​

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