Skip to main content

Abstract Class: AbstractNearestSubscription<T, TAdded, TRemoved>

Defined in: src/sdk/navigation/NearestSubscription.ts:67

A class for tracking a nearest facility session and making it available as a subscribable array of facilities.

Extends

Type Parameters

Type Parameter
T extends Facility
TAdded
TRemoved

Implements

Constructors

Constructor

new AbstractNearestSubscription<T, TAdded, TRemoved>(facilityClient, type): AbstractNearestSubscription<T, TAdded, TRemoved>

Defined in: src/sdk/navigation/NearestSubscription.ts:87

Creates a new instance of AbstractNearestSubscription.

Parameters

ParameterTypeDescription
facilityClientFacilityClientThe client from which to retrieve facilities.
typeAll | Airport | Intersection | Vor | Ndb | User | Visual | AllExceptVisualThe type of facility to search for.

Returns

AbstractNearestSubscription<T, TAdded, TRemoved>

Overrides

AbstractSubscribableArray.constructor

Properties

facilities

protected readonly facilities: T[] = []

Defined in: src/sdk/navigation/NearestSubscription.ts:70


facilityClient

protected readonly facilityClient: FacilityClient

Defined in: src/sdk/navigation/NearestSubscription.ts:88

The client from which to retrieve facilities.


facilityIndex

protected readonly facilityIndex: Map<string, T>

Defined in: src/sdk/navigation/NearestSubscription.ts:71


initialNotifyFunc()

protected readonly initialNotifyFunc: (sub) => void

Defined in: src/sdk/sub/AbstractSubscribableArray.ts:20

A function which sends initial notifications to subscriptions.

Notifies a subscription of this array's current state.

Parameters

ParameterTypeDescription
subHandlerSubscription<SubscribableArrayHandler<T>>The subscription to notify.

Returns

void

Inherited from

AbstractSubscribableArray.initialNotifyFunc


notifyDepth

protected notifyDepth: number = 0

Defined in: src/sdk/sub/AbstractSubscribableArray.ts:17

Inherited from

AbstractSubscribableArray.notifyDepth


onSubDestroyedFunc()

protected readonly onSubDestroyedFunc: (sub) => void

Defined in: src/sdk/sub/AbstractSubscribableArray.ts:23

A function which responds to when a subscription to this subscribable is destroyed.

Responds to when a subscription to this array is destroyed.

Parameters

ParameterTypeDescription
subHandlerSubscription<SubscribableArrayHandler<T>>The destroyed subscription.

Returns

void

Inherited from

AbstractSubscribableArray.onSubDestroyedFunc


session

protected session: undefined | NearestSearchSession<TAdded, TRemoved>

Defined in: src/sdk/navigation/NearestSubscription.ts:73


singletonSub?

protected optional singletonSub: HandlerSubscription<SubscribableArrayHandler<T>>

Defined in: src/sdk/sub/AbstractSubscribableArray.ts:14

Inherited from

AbstractSubscribableArray.singletonSub


startPromiseResolves

protected readonly startPromiseResolves: () => void[] = []

Defined in: src/sdk/navigation/NearestSubscription.ts:75

Returns

void


subs?

protected optional subs: HandlerSubscription<SubscribableArrayHandler<T>>[]

Defined in: src/sdk/sub/AbstractSubscribableArray.ts:16

Inherited from

AbstractSubscribableArray.subs


type

protected readonly type: All | Airport | Intersection | Vor | Ndb | User | Visual | AllExceptVisual

Defined in: src/sdk/navigation/NearestSubscription.ts:89

The type of facility to search for.


updatePromiseResolves

protected readonly updatePromiseResolves: () => void[] = []

Defined in: src/sdk/navigation/NearestSubscription.ts:76

Returns

void

Accessors

length

Get Signature

get length(): number

Defined in: src/sdk/navigation/NearestSubscription.ts:95

The length of this array.

Returns

number

The length of this array.

Implementation of

NearestSubscription.length

Overrides

AbstractSubscribableArray.length


started

Get Signature

get started(): boolean

Defined in: src/sdk/navigation/NearestSubscription.ts:103

Whether or not this subscription has been started.

Returns

boolean

True if started, false otherwise.

Whether this search has started.

Implementation of

NearestSubscription.started

Methods

addFacility()

protected addFacility(facility, key): void

Defined in: src/sdk/navigation/NearestSubscription.ts:198

Adds a facility to the collection.

Parameters

ParameterTypeDescription
facilityTThe facility to add.
keystringThe key to track this facility by.

Returns

void


addSubscription()

protected addSubscription(sub): void

Defined in: src/sdk/sub/AbstractSubscribableArray.ts:29

Adds a subscription to this array.

Parameters

ParameterTypeDescription
subHandlerSubscription<SubscribableArrayHandler<T>>The subscription to add.

Returns

void

Inherited from

AbstractSubscribableArray.addSubscription


awaitStart()

awaitStart(): Promise<void>

Defined in: src/sdk/navigation/NearestSubscription.ts:113

Waits until this search has started.

Returns

Promise<void>

Implementation of

NearestSubscription.awaitStart


doUpdate()

protected doUpdate(lat, lon, radius, maxItems): Promise<void>

Defined in: src/sdk/navigation/NearestSubscription.ts:171

Executes an update of the nearest search subscription.

Parameters

ParameterTypeDescription
latnumberThe latitude of the current search position.
lonnumberThe longitude of the current search position.
radiusnumberThe radius of the search, in meters.
maxItemsnumberThe maximum number of items to return in the search.

Returns

Promise<void>


get()

get(index): T

Defined in: src/sdk/sub/AbstractSubscribableArray.ts:64

Gets an item from the array.

Parameters

ParameterTypeDescription
indexnumberThex index of the item to get.

Returns

T

An item.

Throws

Implementation of

NearestSubscription.get

Inherited from

AbstractSubscribableArray.get


getArray()

getArray(): readonly T[]

Defined in: src/sdk/navigation/NearestSubscription.ts:108

Gets a read-only version of this array.

Returns

readonly T[]

a read-only version of this array.

Implementation of

NearestSubscription.getArray

Overrides

AbstractSubscribableArray.getArray


initialNotify()

protected initialNotify(sub): void

Defined in: src/sdk/sub/AbstractSubscribableArray.ts:163

Notifies a subscription of this array's current state.

Parameters

ParameterTypeDescription
subHandlerSubscription<SubscribableArrayHandler<T>>The subscription to notify.

Returns

void

Inherited from

AbstractSubscribableArray.initialNotify


notify()

protected notify(index, type, modifiedItem?): void

Defined in: src/sdk/sub/AbstractSubscribableArray.ts:87

Notifies subscriptions of a change in the array.

Parameters

ParameterTypeDescription
indexnumberThe index that was changed.
typeSubscribableArrayEventTypeThe type of subject event.
modifiedItem?T | readonly T[]The item modified by the operation.

Returns

void

Inherited from

AbstractSubscribableArray.notify


onResults()

abstract protected onResults(results): Promise<void>

Defined in: src/sdk/navigation/NearestSubscription.ts:191

A callback called when results are received.

Parameters

ParameterTypeDescription
resultsNearestSearchResults<TAdded, TRemoved>The results that were received.

Returns

Promise<void>


onSubDestroyed()

protected onSubDestroyed(sub): void

Defined in: src/sdk/sub/AbstractSubscribableArray.ts:172

Responds to when a subscription to this array is destroyed.

Parameters

ParameterTypeDescription
subHandlerSubscription<SubscribableArrayHandler<T>>The destroyed subscription.

Returns

void

Inherited from

AbstractSubscribableArray.onSubDestroyed


removeFacility()

protected removeFacility(key): void

Defined in: src/sdk/navigation/NearestSubscription.ts:213

Removes a facility from the collection.

Parameters

ParameterTypeDescription
keystringThe key of the facility to remove.

Returns

void


start()

start(): Promise<void>

Defined in: src/sdk/navigation/NearestSubscription.ts:122

Starts this search.

Returns

Promise<void>

Implementation of

NearestSubscription.start


startSearchSession()

abstract protected startSearchSession(): Promise<NearestSearchSession<TAdded, TRemoved>>

Defined in: src/sdk/navigation/NearestSubscription.ts:149

Starts this subscription's nearest search session.

Returns

Promise<NearestSearchSession<TAdded, TRemoved>>

A Promise which will be fulfilled with this subscription's nearest search session once it has been started.


sub()

sub(handler, initialNotify, paused): Subscription

Defined in: src/sdk/sub/AbstractSubscribableArray.ts:41

Subscribes to changes in this array's state.

Parameters

ParameterTypeDefault valueDescription
handlerSubscribableArrayHandler<T>undefinedA function which is called when this array's state changes.
initialNotifybooleanfalseWhether 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.
pausedbooleanfalseWhether the new subscription should be initialized as paused. Defaults to false.

Returns

Subscription

The new subscription.

Implementation of

NearestSubscription.sub

Inherited from

AbstractSubscribableArray.sub


tryGet()

tryGet(index): undefined | T

Defined in: src/sdk/sub/AbstractSubscribableArray.ts:77

Tries to get the value from the array.

Parameters

ParameterTypeDescription
indexnumberThe index of the item to get.

Returns

undefined | T

The value or undefined if not found.

Implementation of

NearestSubscription.tryGet

Inherited from

AbstractSubscribableArray.tryGet


update()

update(lat, lon, radius, maxItems): Promise<void>

Defined in: src/sdk/navigation/NearestSubscription.ts:152

Updates this search with new parameters. If an update is already in progress, this method will wait until the existing update is finished and then fulfill its returned Promise immediately.

Parameters

ParameterTypeDescription
latnumberThe latitude, in degrees, of the center of the search.
lonnumberThe longitude, in degrees, of the center of the search.
radiusnumberThe radius of the search, in meters.
maxItemsnumberThe maximum number of items to return from the search.

Returns

Promise<void>

A Promise which will be fulfilled when the update is complete.

Implementation of

NearestSubscription.update