Construct a new observable list.
The initial items for the list.
The protected internal array of items for the list.
Subclasses may access this array directly as needed.
A signal emitted when the list has changed.
See also: changed
The number of items in the list.
This is a read-only property.
Check whether a normalized index is in range.
Normalize and clamp an index to the list bounds.
Normalize and limit a count to the length of the list.
Normalize an index and offset negative values from the list end.
Add an item to the end of the list.
The item to add to the list.
The index at which the item was added.
Add an item to the list at the specified index.
The index at which to add the item. This must be
an integer in the range [0, internal.length]
.
The item to add at the specified index.
The index at which the item was added.
This may be reimplemented by subclasses to customize the behavior.
Replace the contents of the list with the specified items.
The items to assign to the list.
An array of the previous list items.
This is equivalent to list.replace(0, list.length, items)
.
Remove all items from the list.
An array of the items removed from the list.
This is equivalent to list.replace(0, list.length, [])
.
Test whether the list contains a specific item.
The item of interest.
true
if the list contains the item, false
otherwise.
Get the item at a specific index in the list.
The index of the item of interest. If this is negative, it is offset from the end of the list.
The item at the specified index, or undefined
if the
index is out of range.
Get the index of the first occurence of an item in the list.
The item of interest.
The index of the specified item or -1
if the item is
not contained in the list.
Insert an item into the list at a specific index.
The index at which to insert the item. If this is negative, it is offset from the end of the list. In all cases, it is clamped to the bounds of the list.
The item to insert into the list.
The index at which the item was inserted.
Move an item from one index to another.
The index of the item of interest. If this is negative, it is offset from the end of the list.
The desired index for the item. If this is negative, it is offset from the end of the list.
true
if the item was moved, false
otherwise.
Move an item in the list from one index to another.
The initial index of the item. This must be
an integer in the range [0, internal.length)
.
The desired index for the item. This must be
an integer in the range [0, internal.length)
.
true
if the item was moved, false
otherwise.
This may be reimplemented by subclasses to customize the behavior.
Remove the first occurrence of a specific item from the list.
The item to remove from the list.
The index occupied by the item, or -1
if the item is
not contained in the list.
Remove the item at a specific index.
The index of the item of interest. If this is negative, it is offset from the end of the list.
The item at the specified index, or undefined
if the
index is out of range.
Remove the item from the list at the specified index.
The index of the item to remove. This must be
an integer in the range [0, internal.length)
.
The item removed from the list.
This may be reimplemented by subclasses to customize the behavior.
Replace items at a specific location in the list.
The index at which to modify the list. If this is negative, it is offset from the end of the list. In all cases, it is clamped to the bounds of the list.
The number of items to remove at the given index. This is clamped to the length of the list.
The items to insert at the specified index.
An array of the items removed from the list.
Replace items at a specific location in the list.
The index at which to modify the list. This must
be an integer in the range [0, internal.length]
.
The number of items to remove from the list. This
must be an integer in the range [0, internal.length]
.
The items to insert at the specified index.
An array of the items removed from the list.
This may be reimplemented by subclasses to customize the behavior.
Set the item at a specific index.
The index of interest. If this is negative, it is offset from the end of the list.
The item to set at the index.
The item which occupied the index, or undefined
if the
index is out of range.
Set the item at a specific index in the list.
The index of interest. This must be an integer in
the range [0, internal.length)
.
The item to set at the index.
The item which previously occupied the specified index.
This may be reimplemented by subclasses to customize the behavior.
Get a shallow copy of a portion of the list.
The start index of the slice, inclusive. If this is
negative, it is offset from the end of the list. If this is not
provided, it defaults to 0
. In all cases, it is clamped to the
bounds of the list.
The end index of the slice, exclusive. If this is
negative, it is offset from the end of the list. If this is not
provided, it defaults to length
. In all cases, it is clamped
to the bounds of the list.
A new array containing the specified range of items.
Generated using TypeDoc
A concrete implementation of IObservableList.