Interface IObservableList<T>

A list which can be observed for changes.

interface IObservableList<T> {
    changed: ISignal<IObservableList<T>, IObservableList.IChangedArgs<T>>;
    isDisposed: boolean;
    length: number;
    type: "List";
    [iterator](): Iterator<T, any, undefined>;
    clear(): void;
    dispose(): void;
    get(index): T;
    insert(index, value): void;
    insertAll(index, values): void;
    move(fromIndex, toIndex): void;
    push(value): number;
    pushAll(values): number;
    remove(index): undefined | T;
    removeRange(startIndex, endIndex): number;
    removeValue(value): number;
    set(index, value): void;
}

Type Parameters

  • T

Hierarchy (view full)

Implemented by

Properties

A signal emitted when the list has changed.

isDisposed: boolean

Test whether the object has been disposed.

Notes

This property is always safe to access.

length: number

The length of the list.

Notes

This is a read-only property.

type: "List"

The type of this object.

Methods

  • Returns Iterator<T, any, undefined>

  • Dispose of the resources held by the object.

    Notes

    If the object's dispose method is called more than once, all calls made after the first will be a no-op.

    Undefined Behavior

    It is undefined behavior to use any functionality of the object after it has been disposed unless otherwise explicitly noted.

    Returns void

  • Remove a range of items from the list.

    Parameters

    • startIndex: number

      The start index of the range to remove (inclusive).

    • endIndex: number

      The end index of the range to remove (exclusive).

    Returns number

    The new length of the list.

    Complexity

    Linear.

    Iterator Validity

    Iterators pointing to the first removed value and beyond are invalid.

    Undefined Behavior

    A startIndex or endIndex which is non-integral.

  • Remove the first occurrence of a value from the list.

    Parameters

    • value: T

      The value of interest.

    Returns number

    The index of the removed value, or -1 if the value is not contained in the list.

    Complexity

    Linear.

    Iterator Validity

    Iterators pointing at the removed value and beyond are invalidated.