Class FlightCollection

A collection of flights. Provides playFlight API, which returns a FlightPlayer. Emits playerChanged event, whenever another flight is played.

Hierarchy (view full)

Accessors

  • get uniqueKey(): undefined | keyof T
  • The key by which to check uniqueness against. undefined if no uniqueness constraint is set.

    Returns undefined | keyof T

Constructors

Methods

  • Protected

    internal remove function, to remove an item from the collection, does not raise an event.

    Parameters

    Returns number

    returns the index of the removed item or -1 if the item has not been found.

  • Returns an item identified by the unique constraint key. Returns null, if there is no uniqueness constraint.

    Parameters

    • value: unknown

      the value to test against. does a shallow comparison, if the passed a non-atomic value

    Returns undefined | FlightInstance

  • Returns true, if the key exists. Returns undefined, if there is no uniqueness constraint.

    Parameters

    • value: unknown

    Returns undefined | boolean

  • Creates a Collection from an iterable, such as an Array.

    Type Parameters

    • F

    Parameters

    • iterable: Iterable<F, any, any>
    • OptionaluniqueKey: false | keyof F

      a key to maintain uniquely within the collection. passing false disables uniqueness.

    Returns Collection<F>

Properties

_array: FlightInstance[]

Event raised if an item is added. Is passed the added item.

playerChanged: VcsEvent<undefined | FlightPlayer>

Event raised if an item is removed. Is passed the removed item.