Skip to content

API > @blocksuite/store > Y > Map

Class: Map<MapType> ​

Implements ​

Extends ​

Implements ​

  • Iterable< [string, MapType] >

Constructors ​

constructor ​

new Map<MapType>(entries?): Map< MapType >

Type parameters ​

Parameter
MapType

Parameters ​

ParameterTypeDescription
entries?Iterable< readonly [string, any] >an optional iterable to initialize the YMap

Returns ​

Map< MapType >

Overrides ​

AbstractType.constructor

Defined In ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/types/YMap.d.ts:27

Properties ​

_dEH ​

_dEH: EventHandler< YEvent< any >[], Transaction >

Deep event handlers

Defined In ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/types/AbstractType.d.ts:46

Inherited from ​

AbstractType._dEH


_eH ​

_eH: EventHandler< YMapEvent< MapType >, Transaction >

Event handlers

Defined In ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/types/AbstractType.d.ts:41

Inherited from ​

AbstractType._eH


_item ​

_item: null | Item

Defined In ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/types/AbstractType.d.ts:23

Inherited from ​

AbstractType._item


_length ​

_length: number

Defined In ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/types/AbstractType.d.ts:36

Inherited from ​

AbstractType._length


_map ​

_map: Map< string, Item >

Defined In ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/types/AbstractType.d.ts:27

Inherited from ​

AbstractType._map


_prelimContent ​

private _prelimContent: any

Defined In ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/types/YMap.d.ts:32


_searchMarker ​

_searchMarker: null | ArraySearchMarker[]

Defined In ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/types/AbstractType.d.ts:50

Inherited from ​

AbstractType._searchMarker


_start ​

_start: null | Item

Defined In ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/types/AbstractType.d.ts:31

Inherited from ​

AbstractType._start


doc ​

doc: null | Doc

Defined In ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/types/AbstractType.d.ts:35

Inherited from ​

AbstractType.doc

Accessors ​

_first ​

get _first(): null | Item

Defined In ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/types/AbstractType.d.ts:81

Inherited from ​

AbstractType._first


parent ​

get parent(): null | AbstractType< any >

Defined In ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/types/AbstractType.d.ts:54

Inherited from ​

AbstractType.parent


size ​

get size(): number

Defined In ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/types/YMap.d.ts:65

Methods ​

[iterator] ​

[iterator](): IterableIterator< [string, MapType] >

Returns an Iterator of [key, value] pairs

Returns ​

IterableIterator< [string, MapType] >

Implementation of ​

Iterable.[iterator]

Defined In ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/types/YMap.d.ts:128


_callObserver ​

_callObserver(transaction, _parentSubs): void

Creates YEvent and calls all type observers. Must be implemented by each type.

Parameters ​

ParameterTypeDescription
transactionTransaction-
_parentSubsSet< null | string >Keys changed on this type. null if list was modified.

Returns ​

void

Inherited from ​

AbstractType._callObserver

Defined In ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/types/AbstractType.d.ts:89


_copy ​

_copy(): Map< MapType >

Returns ​

Map< MapType >

Overrides ​

AbstractType._copy

Defined In ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/types/YMap.d.ts:47


_integrate ​

_integrate(y, item): void

Integrate this type into the Yjs instance.

  • Save this struct in the os
  • This type is sent to other client
  • Observer functions are fired

Parameters ​

ParameterTypeDescription
yDocThe Yjs instance
itemItem-

Returns ​

void

Overrides ​

AbstractType._integrate

Defined In ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/types/YMap.d.ts:43


_write ​

_write(_encoder): void

Parameters ​

ParameterType
_encoderUpdateEncoderV1 | UpdateEncoderV2

Returns ​

void

Inherited from ​

AbstractType._write

Defined In ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/types/AbstractType.d.ts:77


clear ​

clear(): void

Removes all elements from this YMap.

Returns ​

void

Defined In ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/types/YMap.d.ts:122


clone ​

clone(): Map< MapType >

Returns ​

Map< MapType >

Overrides ​

AbstractType.clone

Defined In ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/types/YMap.d.ts:51


delete ​

delete(key): void

Remove a specified element from this YMap.

Parameters ​

ParameterTypeDescription
keystringThe key of the element to remove.

Returns ​

void

Defined In ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/types/YMap.d.ts:95


entries ​

entries(): IterableIterator< [string, MapType] >

Returns an Iterator of [key, value] pairs

Returns ​

IterableIterator< [string, MapType] >

Defined In ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/types/YMap.d.ts:83


forEach ​

forEach(f): void

Executes a provided function on once on every key-value pair.

Parameters ​

ParameterTypeDescription
ffunctionA function to execute on every element of this YArray.

Returns ​

void

Defined In ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/types/YMap.d.ts:89


get ​

get(key): undefined | MapType

Returns a specified element from this YMap.

Parameters ​

ParameterType
keystring

Returns ​

undefined | MapType

Defined In ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/types/YMap.d.ts:111


has ​

has(key): boolean

Returns a boolean indicating whether the specified key exists or not.

Parameters ​

ParameterTypeDescription
keystringThe key to test.

Returns ​

boolean

Defined In ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/types/YMap.d.ts:118


keys ​

keys(): IterableIterator< string >

Returns the keys for each element in the YMap Type.

Returns ​

IterableIterator< string >

Defined In ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/types/YMap.d.ts:71


observe ​

observe(f): void

Observe all events that are created on this type.

Parameters ​

ParameterTypeDescription
ffunctionObserver function

Returns ​

void

Inherited from ​

AbstractType.observe

Defined In ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/types/AbstractType.d.ts:95


observeDeep ​

observeDeep(f): void

Observe all events that are created by this type and its children.

Parameters ​

ParameterTypeDescription
ffunctionObserver function

Returns ​

void

Inherited from ​

AbstractType.observeDeep

Defined In ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/types/AbstractType.d.ts:101


set ​

set<VAL>(key, value): VAL

Adds or updates an element with a specified key and value.

Type parameters ​

Parameter
VAL

Parameters ​

ParameterTypeDescription
keystringThe key of the element to add to this YMap
valueVALThe value of the element to add

Returns ​

VAL

Defined In ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/types/YMap.d.ts:104


toJSON ​

toJSON(): object

Transforms this Shared Type to a JSON object.

Returns ​

object

Overrides ​

AbstractType.toJSON

Defined In ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/types/YMap.d.ts:57


unobserve ​

unobserve(f): void

Unregister an observer function.

Parameters ​

ParameterTypeDescription
ffunctionObserver function

Returns ​

void

Inherited from ​

AbstractType.unobserve

Defined In ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/types/AbstractType.d.ts:107


unobserveDeep ​

unobserveDeep(f): void

Unregister an observer function.

Parameters ​

ParameterTypeDescription
ffunctionObserver function

Returns ​

void

Inherited from ​

AbstractType.unobserveDeep

Defined In ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/types/AbstractType.d.ts:113


values ​

values(): IterableIterator< MapType >

Returns the values for each element in the YMap Type.

Returns ​

IterableIterator< MapType >

Defined In ​

node_modules/.pnpm/yjs@13.6.10/node_modules/yjs/dist/src/types/YMap.d.ts:77