Home Reference Source
import YMap from 'yjs/src/Types/YMap/YMap.js'
public class | source

YMap

Extends:

ItemType → YMap

Direct Subclass:

YXmlHook

A shared Map implementation.

Method Summary

Public Methods
public

Remove a specified element from this YMap.

public

get(key: encodable): *

Returns a specified element from this YMap.

public

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

public

keys(): Array

Returns the keys for each element in the YMap Type.

public

set(key: encodable, value: encodable | YType): *

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

public

Transforms this Shared Type to a JSON object.

Inherited Summary

From class Type
public

getPathTo(type: YType): Array<string>

Compute the path from this type to the specified target.

public

Observe all events that are created on this type.

public

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

public

Unregister an observer function.

public

Unregister an observer function.

Public Methods

public delete(key: encodable) source

Remove a specified element from this YMap.

Params:

NameTypeAttributeDescription
key encodable

The key of the element to remove.

public get(key: encodable): * source

Returns a specified element from this YMap.

Params:

NameTypeAttributeDescription
key encodable

The key of the element to return.

Return:

*

public has(key: encodable): boolean source

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

Params:

NameTypeAttributeDescription
key encodable

The key to test.

Return:

boolean

public keys(): Array source

Returns the keys for each element in the YMap Type.

Return:

Array

public set(key: encodable, value: encodable | YType): * source

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

Params:

NameTypeAttributeDescription
key encodable

The key of the element to add to this YMap.

value encodable | YType

The value of the element to add to this YMap.

Return:

*

public toJSON(): Object source

Transforms this Shared Type to a JSON object.

Return:

Object