Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ObservableOutputs

An observable list that handles output area data.

Hierarchy

Implements

Index

Constructors

constructor

  • Construct a new observable list.

    Parameters

    • Optional items: IOutput[]

      The initial items for the list.

    Returns ObservableOutputs

Properties

Private _clearNext

_clearNext: boolean

changed

changed: ISignal<ObservableList<IOutput>, IListChangedArgs<IOutput>>

A signal emitted when the list has changed.

Notes

This is a pure delegate to the changedSignal.

Protected internal

internal: IOutput[]

The protected internal array of items for the list.

Notes

Subclasses may access this array directly as needed.

length

length: number

The number of items in the list.

Notes

This is a read-only property.

Static changedSignal

changedSignal: Signal<ObservableList<any>, IListChangedArgs<any>>

A signal emitted when the list has changed.

See also: changed

Methods

add

  • Add an output, which may be combined with previous output (e.g. for streams).

    Parameters

    Returns number

Protected addItem

  • addItem(index: number, item: IOutput): number
  • Add an item to the list at the specified index.

    Parameters

    • index: number

      The index at which to add the item. This must be an integer in the range [0, internal.length].

    • item: IOutput

      The item to add at the specified index.

    Returns number

    The index at which the item was added.

    Notes

    This may be reimplemented by subclasses to customize the behavior.

assign

  • Replace the contents of the list with the specified items.

    Parameters

    • items: IOutput[]

      The items to assign to the list.

    Returns IOutput[]

    An array of the previous list items.

    Notes

    This is equivalent to list.replace(0, list.length, items).

clear

  • Clear all of the output.

    Parameters

    • Default value wait: boolean = false

      Delay clearing the output until the next message is added.

    Returns IOutput[]

contains

  • Test whether the list contains a specific item.

    Parameters

    • item: IOutput

      The item of interest.

    Returns boolean

    true if the list contains the item, false otherwise.

get

  • Get the item at a specific index in the list.

    Parameters

    • index: number

      The index of the item of interest. If this is negative, it is offset from the end of the list.

    Returns IOutput

    The item at the specified index, or undefined if the index is out of range.

indexOf

  • Get the index of the first occurence of an item in the list.

    Parameters

    • item: IOutput

      The item of interest.

    Returns number

    The index of the specified item or -1 if the item is not contained in the list.

insert

  • insert(index: number, item: IOutput): number
  • Insert an item into the list at a specific index.

    Parameters

    • index: number

      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.

    • item: IOutput

      The item to insert into the list.

    Returns number

    The index at which the item was inserted.

move

  • move(fromIndex: number, toIndex: number): boolean
  • Move an item from one index to another.

    Parameters

    • fromIndex: number

      The index of the item of interest. If this is negative, it is offset from the end of the list.

    • toIndex: number

      The desired index for the item. If this is negative, it is offset from the end of the list.

    Returns boolean

    true if the item was moved, false otherwise.

Protected moveItem

  • moveItem(fromIndex: number, toIndex: number): boolean
  • Move an item in the list from one index to another.

    Parameters

    • fromIndex: number

      The initial index of the item. This must be an integer in the range [0, internal.length).

    • toIndex: number

      The desired index for the item. This must be an integer in the range [0, internal.length).

    Returns boolean

    true if the item was moved, false otherwise.

    Notes

    This may be reimplemented by subclasses to customize the behavior.

remove

  • Remove the first occurrence of a specific item from the list.

    Parameters

    • item: IOutput

      The item to remove from the list.

    Returns number

    The index occupied by the item, or -1 if the item is not contained in the list.

removeAt

  • Remove the item at a specific index.

    Parameters

    • index: number

      The index of the item of interest. If this is negative, it is offset from the end of the list.

    Returns IOutput

    The item at the specified index, or undefined if the index is out of range.

Protected removeItem

  • removeItem(index: number): IOutput
  • Remove the item from the list at the specified index.

    Parameters

    • index: number

      The index of the item to remove. This must be an integer in the range [0, internal.length).

    Returns IOutput

    The item removed from the list.

    Notes

    This may be reimplemented by subclasses to customize the behavior.

replace

  • Replace items at a specific location in the list.

    Parameters

    • index: number

      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.

    • count: number

      The number of items to remove at the given index. This is clamped to the length of the list.

    • items: IOutput[]

      The items to insert at the specified index.

    Returns IOutput[]

    An array of the items removed from the list.

Protected replaceItems

  • replaceItems(index: number, count: number, items: IOutput[]): IOutput[]
  • Replace items at a specific location in the list.

    Parameters

    • index: number

      The index at which to modify the list. This must be an integer in the range [0, internal.length].

    • count: number

      The number of items to remove from the list. This must be an integer in the range [0, internal.length].

    • items: IOutput[]

      The items to insert at the specified index.

    Returns IOutput[]

    An array of the items removed from the list.

    Notes

    This may be reimplemented by subclasses to customize the behavior.

set

  • Set the item at a specific index.

    Parameters

    • index: number

      The index of interest. If this is negative, it is offset from the end of the list.

    • item: IOutput

      The item to set at the index.

    Returns IOutput

    The item which occupied the index, or undefined if the index is out of range.

Protected setItem

  • Set the item at a specific index in the list.

    Parameters

    • index: number

      The index of interest. This must be an integer in the range [0, internal.length).

    • item: IOutput

      The item to set at the index.

    Returns IOutput

    The item which previously occupied the specified index.

    Notes

    This may be reimplemented by subclasses to customize the behavior.

slice

  • slice(start?: number, end?: number): IOutput[]
  • Get a shallow copy of a portion of the list.

    Parameters

    • Optional start: number

      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.

    • Optional end: number

      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.

    Returns IOutput[]

    A new array containing the specified range of items.

Generated using TypeDoc