Skip to main content

Class: NearestWaypointArray<T, EntryType>

Defined in: src/workingtitle-instruments-g3000/html_ui/Shared/Nearest/NearestWaypointArray.ts:66

An array of nearest waypoints backed by a nearest facilities subscription. Supports GPS data integrity state so that the array will be empty when no GPS position is available. Also supports pausing and resuming automatic updates from the backing nearest facilities subscription.

Type Parameters​

Type ParameterDefault type
T extends NearestWaypointFacilityType-
EntryType extends NearestWaypointEntry<NearestWaypointTypeMap[T]>NearestWaypointEntry<NearestWaypointTypeMap[T]>

Implements​

Constructors​

Constructor​

new NearestWaypointArray<T, EntryType>(bus, waypointEntryFactory, isGpsDataFailed, gpsFailClearDelay): NearestWaypointArray<T, EntryType>

Defined in: src/workingtitle-instruments-g3000/html_ui/Shared/Nearest/NearestWaypointArray.ts:98

Constructor.

Parameters​

ParameterTypeDescription
busEventBusThe event bus.
waypointEntryFactory(waypoint) => EntryTypeA function which creates nearest waypoint entries for this array.
isGpsDataFailedSubscribable<boolean>Whether GPS data is in a failed state.
gpsFailClearDelaynumberThe delay, in milliseconds, after GPS data enters a failed state before this array is cleared of all waypoints.

Returns​

NearestWaypointArray<T, EntryType>

Accessors​

length​

Get Signature​

get length(): number

Defined in: src/workingtitle-instruments-g3000/html_ui/Shared/Nearest/NearestWaypointArray.ts:76

The length of this array.

Returns​

number

The length of this array.

Implementation of​

SubscribableArray.length

Methods​

destroy()​

destroy(): void

Defined in: src/workingtitle-instruments-g3000/html_ui/Shared/Nearest/NearestWaypointArray.ts:321

Destroys this array. Once this array is destroyed, it will be emptied and will no longer automatically update its contents and cannot be paused or resumed.

Returns​

void


get()​

get(index): EntryType

Defined in: src/workingtitle-instruments-g3000/html_ui/Shared/Nearest/NearestWaypointArray.ts:216

Retrieves an element from this array.

Parameters​

ParameterTypeDescription
indexnumberThe index of the element.

Returns​

EntryType

the element at the specified index.

Throws​

Error if index is out of bounds.

Implementation of​

SubscribableArray.get


getArray()​

getArray(): readonly EntryType[]

Defined in: src/workingtitle-instruments-g3000/html_ui/Shared/Nearest/NearestWaypointArray.ts:226

Gets a read-only version of this array.

Returns​

readonly EntryType[]

a read-only version of this array.

Implementation of​

SubscribableArray.getArray


init()​

init(nearestSubscription, paused): void

Defined in: src/workingtitle-instruments-g3000/html_ui/Shared/Nearest/NearestWaypointArray.ts:112

Initializes this array.

Parameters​

ParameterTypeDefault valueDescription
nearestSubscriptionNearestSubscription<FacilityTypeMap[T]>undefinedThe nearest facility subscription that will provide this array's nearest waypoint data.
pausedbooleanfalseWhether the array should be paused when initialized.

Returns​

void

Throws​

Error if this array has been destroyed.


pause()​

pause(): void

Defined in: src/workingtitle-instruments-g3000/html_ui/Shared/Nearest/NearestWaypointArray.ts:200

Pauses this array. Once paused, this array's contents will no longer automatically update until it is resumed.

Returns​

void

Throws​

Error if this array has been destroyed.


resume()​

resume(): void

Defined in: src/workingtitle-instruments-g3000/html_ui/Shared/Nearest/NearestWaypointArray.ts:182

Resumes this array. Once resumed, this array will automatically update its contents until it is paused or destroyed.

Returns​

void

Throws​

Error if this array has been destroyed.


sub()​

sub(handler, initialNotify?, paused?): Subscription

Defined in: src/workingtitle-instruments-g3000/html_ui/Shared/Nearest/NearestWaypointArray.ts:231

Subscribes to changes in this array's state.

Parameters​

ParameterTypeDescription
handlerSubscribableArrayHandler<EntryType>A function which is called when this array's state changes.
initialNotify?booleanWhether to immediately invoke the callback function with this array's current state. Defaults to false. This argument is ignored if the subscription is initialized as paused.
paused?booleanWhether the new subscription should be initialized as paused. Defaults to false.

Returns​

Subscription

The new subscription.

Implementation of​

SubscribableArray.sub


tryGet()​

tryGet(index): EntryType | undefined

Defined in: src/workingtitle-instruments-g3000/html_ui/Shared/Nearest/NearestWaypointArray.ts:221

Attempts to retrieve an element from this array.

Parameters​

ParameterTypeDescription
indexnumberThe index of the element.

Returns​

EntryType | undefined

the element at the specified index, or undefined if index is out of bounds.

Implementation of​

SubscribableArray.tryGet