YArray
Direct Subclass:
Indirect Subclass:
A shared Array implementation.
Member Summary
Public Members | ||
public get |
length: * Computes the length of this YArray. |
Method Summary
Public Methods | ||
public |
[Symbol.iterator](): {"next": *, "_item": *, "_itemElement": *, "_count": *} |
|
public |
delete(index: Integer, length: Integer) Deletes elements starting from an index. |
|
public |
Executes a provided function on once on overy element of this YArray. |
|
public |
get(index: Integer): * Returns the i-th element from a YArray. |
|
public |
Inserts new content at an index. |
|
public |
Returns an Array with the result of calling a provided function on every element of this YArray. |
|
public |
Appends content to this YArray. |
|
public |
Transforms this YArray to a JavaScript Array. |
|
public |
Transforms this Shared Type to a JSON object. |
Inherited Summary
From class Type | ||
public |
Compute the path from this type to the specified target. |
|
public |
Observe all events that are created on this type. |
|
public |
observeDeep(f: Function) Observe all events that are created by this type and its children. |
|
public |
Unregister an observer function. |
|
public |
Unregister an observer function. |
Public Members
Public Methods
public [Symbol.iterator](): {"next": *, "_item": *, "_itemElement": *, "_count": *} source
Return:
{"next": *, "_item": *, "_itemElement": *, "_count": *} |
public delete(index: Integer, length: Integer) source
Deletes elements starting from an index.
Params:
Name | Type | Attribute | Description |
index | Integer | Index at which to start deleting elements |
|
length | Integer | The number of elements to remove. Defaults to 1. |
public forEach(f: Function) source
Executes a provided function on once on overy element of this YArray.
Params:
Name | Type | Attribute | Description |
f | Function | A function to execute on every element of this YArray. |
public get(index: Integer): * source
Returns the i-th element from a YArray.
Params:
Name | Type | Attribute | Description |
index | Integer | The index of the element to return from the YArray |
Return:
* |
public insert(index: Integer, content: Array) source
Inserts new content at an index.
Important: This function expects an array of content. Not just a content object. The reason for this "weirdness" is that inserting several elements is very efficient when it is done as a single operation.
Params:
Name | Type | Attribute | Description |
index | Integer | The index to insert content at. |
|
content | Array | The array of content |
Example:
// Insert character 'a' at position 0
yarray.insert(0, ['a'])
// Insert numbers 1, 2 at position 1
yarray.insert(2, [1, 2])
public map(f: Function): Array source
Returns an Array with the result of calling a provided function on every element of this YArray.
Params:
Name | Type | Attribute | Description |
f | Function | Function that produces an element of the new Array |