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: { id: string }

Hierarchy

Index

Constructors

constructor

Properties

Readonly collectionChanged

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

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[]
  • Converts to a javascript array

    Returns T[]

clear

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

    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

getById

  • getById(id: string): T
  • Gets an item by Id

    Parameters

    • id: string

    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): void
  • Removes an item by value. Raises the collectionChanged event to subscribers

    Parameters

    • item: T

    Returns void

removeAt

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

    Parameters

    • index: number

    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