new YMap(entries)
Parameters:
| Name | Type | Description |
|---|---|---|
entries |
- Implements:
- Iterable.<T>
Extends
- AbstractType.<YMapEvent.<T>>
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 transactionTransaction parentSubsSet.<(null|string)> Keys changed on this type.
nullif 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 yDoc The Yjs instance
itemItem -
_write(encoder)
-
Parameters:
Name Type Description encoderAbstractUpdateEncoder -
delete(key)
-
Remove a specified element from this YMap.
Parameters:
Name Type Description keystring 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 ffunction 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 keystring Returns:
T | undefined -
has(key) → {boolean}
-
Returns a boolean indicating whether the specified key exists or not.
Parameters:
Name Type Description keystring 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 keystring The key of the element to add to this YMap
valueT 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>