Options
All
  • Public
  • Public/Protected
  • All
Menu

A collection keeping track of a number of objects ordered by when they were touched.

Type parameters

  • T

Hierarchy

  • RecentlyUsedList

Index

Constructors

Accessors

Methods

Constructors

constructor

  • new RecentlyUsedList<T>(maxSize?: number, equality?: (a: T, b: T) => boolean): RecentlyUsedList<T>
  • Type parameters

    • T

    Parameters

    • maxSize: number = 5

      The maximum number of items in the list. Old items will automatically be evicted.

    • Optional equality: (a: T, b: T) => boolean

      If given, this equality function will be used to determine whether a touched object matches one already in the list. If not given, coercing object equality will be used.

        • (a: T, b: T): boolean
        • Parameters

          • a: T
          • b: T

          Returns boolean

    Returns RecentlyUsedList<T>

Accessors

value

  • get value(): T[]
  • The current list of objects.

    Returns T[]

valueChanges

  • get valueChanges(): Observable<T[]>
  • An observable emitting a new version of the list every time an object is touched.

    Returns Observable<T[]>

Methods

touch

  • touch(used: T): T
  • Registers the "use" of the given object, adding it (or moving it) to the start of the list, evicting the oldest entry if the list grows beyond its max size.

    Parameters

    • used: T

    Returns T