YMap.YMap(entries)

new YMap(entries)

Parameters:
Name Type Description
entries
Implements:
  • Iterable.<T>

Extends

Members

size

Returns the size of the YMap (count of key/value pairs)

Methods

_callObserver(transaction, parentSubs)

Creates YMapEvent and calls observers.

Parameters:
Name Type Description
transaction Transaction
parentSubs Set.<(null|string)>

Keys changed on this type. null if list was modified.

_integrate(y, item)

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:
Name Type Description
y Doc

The Yjs instance

item Item

_write(encoder)

Parameters:
Name Type Description
encoder AbstractUpdateEncoder

delete(key)

Remove a specified element from this YMap.

Parameters:
Name Type Description
key string

The key of the element to remove.

entries() → {IterableIterator.<any>}

Returns an Iterator of [key, value] pairs

Returns:
IterableIterator.<any>

forEach(f)

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

Parameters:
Name Type Description
f function

A function to execute on every element of this YArray.

get(key) → {T|undefined}

Returns a specified element from this YMap.

Parameters:
Name Type Description
key string
Returns:
T | undefined

has(key) → {boolean}

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

Parameters:
Name Type Description
key string

The key to test.

Returns:
boolean

keys() → {IterableIterator.<string>}

Returns the keys for each element in the YMap Type.

Returns:
IterableIterator.<string>

set(key, value)

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

Parameters:
Name Type Description
key string

The key of the element to add to this YMap

value T

The value of the element to add

Symbol.iterator() → {IterableIterator.<T>}

Returns:
IterableIterator.<T>

toJSON() → {Object.<string, T>}

Transforms this Shared Type to a JSON object.

Returns:
Object.<string, T>

values() → {IterableIterator.<string>}

Returns the keys for each element in the YMap Type.

Returns:
IterableIterator.<string>