Options
All
  • Public
  • Public/Protected
  • All
Menu

An Observable array which raises collectionChanged events when an item is added, removed or the collection cleared

Type parameters

  • T

Hierarchy

Index

Constructors

constructor

Properties

Readonly collectionChanged

Event handler which fires when the collection changes. See ObservableArrayChangedArgs for args

Protected items

items: T[] = []

Methods

add

  • add(...items: T[]): void
  • Adds items to the array, and raises the collectionChanged event to subscribers

    Parameters

    • Rest ...items: T[]

    Returns void

asArray

  • asArray(): T[]
  • Returns the backing array. Do not modify this collection. Use add or remove instead.

    Returns T[]

clear

  • clear(callDeleteOnChildren?: boolean): void
  • Clears the array. Raises the collectionChanged event to subscribers

    Parameters

    • Default value callDeleteOnChildren: boolean = false

      When true, if the items in the array implement the IDeletable interface, the delete() function will be called. Defaults to false for backward compatibility

    Returns void

contains

  • contains(item: T): boolean
  • Returns true if the array contains an item

    Parameters

    • item: T

    Returns boolean

get

  • get(index: number): T
  • Gets an item at index

    Parameters

    • index: number

    Returns T

insert

  • insert(index: number, item: T): void
  • Inserts items at the specified index. Raises the collectionChanged event to subscribers

    Parameters

    • index: number
    • item: T

    Returns void

remove

  • remove(item: T, callDeleteOnChildren?: boolean): void
  • Removes an item by value. Raises the collectionChanged event to subscribers

    Parameters

    • item: T

      The item to remove

    • Default value callDeleteOnChildren: boolean = false

      When true, if the items in the array implement the IDeletable interface, the delete() function will be called. Defaults to false for backward compatibility

    Returns void

removeAt

  • removeAt(index: number, callDeleteOnChildren?: boolean): void
  • Removes an item at the specified index. Raises the collectionChanged event to subscribers

    Parameters

    • index: number

      The item to remove

    • Default value callDeleteOnChildren: boolean = false

      When true, if the items in the array implement the IDeletable interface, the delete() function will be called. Defaults to false for backward compatibility

    Returns void

set

  • set(index: number, item: T): void
  • Sets an item at index. Raises the collectionChanged event to subscribers

    Parameters

    • index: number
    • item: T

    Returns void

size

  • size(): number
  • gets the number of elements in the array

    Returns number

Generated using TypeDoc