ListAutoDispose

Type class

A version of a List where the elements are disposed automatically when removed from the list, unless autoDispose is set to false.

Sources

This information about ListAutoDispose is provided for reference only and is not available through exported packages and thus should not be imported or used on its own.

Inheritance

ListAutoDispose extends List.

ListAutoDispose is extended by ListTemplate.

Settings

ListAutoDispose does not have any settings.

Private settings

ListAutoDispose does not have any private settings.

Properties

autoDispose
#

Type boolean

Default true

Automatically disposes elements that are removed from the list.

events
#

Type EventDispatcher

Default new EventDispatcher()

Inherited from List

length
#

Type number

Inherited from List

Number of items in list.

@readonly

values
#

Type Array

Inherited from List

An array of values in the list.

Don't change this array directly: use methods like push() and removeIndex(), which dispatch the list's events.

@readonly

There are 3 inherited items currently hidden from this list.

Methods

[Symbol.iterator]()

#

Returns Iterator

Inherited from List

Returns an ES6 iterator for the list.

clear()

#

Returns void

Inherited from List

Removes all items from the list.

constructor(

initial: Array

)

#

Returns ListAutoDispose

Inherited from List

Constructor

contains(

value: A

)

#

Returns boolean

Inherited from List

Checks if list contains specific item reference.

copyFrom(

source: this

)

#

Returns void

Inherited from List

Adds all items of another list to the end of this one.

dispose()

#

Returns void

each(

f: ( value: A, index: number) => void

)

#

Returns void

Inherited from List

Calls f for each item in the list, with the item and its index.

eachReverse(

f: ( value: A, index: number) => void

)

#

Returns void

Inherited from List

Calls f for each item in the list, from last to first, with the item and its index.

getIndex(

index: number

)

#

Returns A | undefined

Inherited from List

Returns an item at specified index.

hasIndex(

index: number

)

#

Returns boolean

Inherited from List

Checks if there's a value at specific index.

indexOf(

value: A

)

#

Returns number

Inherited from List

Searches the list for specific item and returns its index.

insertIndex(

index: number,
value: K

)

#

Returns K

Inherited from List

Inserts an item at index, moving the items from there on one place further.

isDisposed()

#

Returns boolean

moveValue(

value: K,
toIndex?: undefined | number

)

#

Returns K

Inherited from List

Moves an item to toIndex, or to the end of the list if toIndex is not set. An item that is not in the list yet is added.

pop()

#

Returns Optional

Inherited from List

Returns the last item from the list, and removes it.

push(

value: K

)

#

Returns K

Inherited from List

Adds an item to the end of the list.

pushAll(

values: Array

)

#

Returns void

Inherited from List

Adds multiple items to the end of the list.

removeIndex(

index: number

)

#

Returns A

Inherited from List

Removes a value at specific index.

removeValue(

value: A

)

#

Returns void

Inherited from List

Removes all copies of an item from the list.

setAll(

newArray: Array

)

#

Returns void

Inherited from List

Replaces all items in the list with newArray.

setIndex(

index: number,
value: A

)

#

Returns A

Inherited from List

Replaces the value at index, which must already exist.

shift()

#

Returns Optional

Inherited from List

Returns the first item from the list, and removes it.

swap(

a: number,
b: number

)

#

Returns void

Swaps two items in the list, without disposing them.

unshift(

value: K

)

#

Returns K

Inherited from List

Adds an item as a first item in the list.

There are 21 inherited items currently hidden from this list.

Events

Add event handlers to ListAutoDispose object using its events.on() method.

Read about adding event handlers.

#clear

Param { oldValues: Array,
  type: "clear",
  target: this }

Inherited from List

All items were removed, by clear() or setAll().

#insertIndex

Param { index: number,
  newValue: A,
  type: "insertIndex",
  target: this }

Inherited from List

An item was inserted at index.

#moveIndex

Param { newIndex: number,
  oldIndex: number,
  value: A,
  type: "moveIndex",
  target: this }

Inherited from List

An item was moved from oldIndex to newIndex.

#push

Param { newValue: A,
  type: "push",
  target: this }

Inherited from List

An item was added to the end of the list.

#removeIndex

Param { index: number,
  oldValue: A,
  type: "removeIndex",
  target: this }

Inherited from List

The item at index was removed.

#setIndex

Param { index: number,
  newValue: A,
  oldValue: A,
  type: "setIndex",
  target: this }

Inherited from List

The item at index was replaced.

#swap

Param { a: A,
  b: A,
  type: "swap",
  target: this }

Inherited from List

Two items swapped places.

There are 7 inherited items currently hidden from this list.