Skip to main content

Class: AdaptiveNearestSubscription<InnerType>

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

A wrapper for a NearestSearchSession that automatically adjusts the number of search results requested from the sim to minimize search load while still attempting to provide the total number of results needed by the user.

Extends​

Type Parameters​

Type Parameter
InnerType extends NearestSubscription<any>

Implements​

Constructors​

Constructor​

new AdaptiveNearestSubscription<InnerType>(innerSubscription, absoluteMaxItems): AdaptiveNearestSubscription<InnerType>

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

Creates an instance of AdaptiveNearestSubscription.

Parameters​

ParameterTypeDescription
innerSubscriptionInnerTypeA NearestSubscription to use as our inner search.
absoluteMaxItemsnumber | Subscribable<number>The maximum number of results to request in any search.

Returns​

AdaptiveNearestSubscription<InnerType>

Overrides​

AbstractSubscribableArray.constructor

Properties​

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<NearestSubscriptionFacilityType<InnerType>>>The subscription to notify.

Returns​

void

Inherited from​

AbstractSubscribableArray.initialNotifyFunc


innerSubscription​

readonly innerSubscription: InnerType

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

A NearestSubscription to use as our inner search.


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<NearestSubscriptionFacilityType<InnerType>>>The destroyed subscription.

Returns​

void

Inherited from​

AbstractSubscribableArray.onSubDestroyedFunc


singletonSub?​

protected optional singletonSub: HandlerSubscription<SubscribableArrayHandler<NearestSubscriptionFacilityType<InnerType>>>

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

Inherited from​

AbstractSubscribableArray.singletonSub


subs?​

protected optional subs: HandlerSubscription<SubscribableArrayHandler<NearestSubscriptionFacilityType<InnerType>>>[]

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

Inherited from​

AbstractSubscribableArray.subs

Accessors​

length​

Get Signature​

get length(): number

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

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:712

Whether this search has started.

Returns​

boolean

Whether this search has started.

Implementation of​

NearestSubscription.started

Methods​

addSubscription()​

protected addSubscription(sub): void

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

Adds a subscription to this array.

Parameters​

ParameterTypeDescription
subHandlerSubscription<SubscribableArrayHandler<NearestSubscriptionFacilityType<InnerType>>>The subscription to add.

Returns​

void

Inherited from​

AbstractSubscribableArray.addSubscription


awaitStart()​

awaitStart(): Promise<void>

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

Waits until this search has started.

Returns​

Promise<void>

Implementation of​

NearestSubscription.awaitStart


get()​

get(index): NearestSubscriptionFacilityType

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

Gets an item from the array.

Parameters​

ParameterTypeDescription
indexnumberThex index of the item to get.

Returns​

NearestSubscriptionFacilityType

An item.

Throws​

Implementation of​

NearestSubscription.get

Inherited from​

AbstractSubscribableArray.get


getArray()​

getArray(): readonly NearestSubscriptionFacilityType<InnerType>[]

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

Gets a read-only version of this array.

Returns​

readonly NearestSubscriptionFacilityType<InnerType>[]

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<NearestSubscriptionFacilityType<InnerType>>>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?NearestSubscriptionFacilityType<InnerType> | readonly NearestSubscriptionFacilityType<InnerType>[]The item modified by the operation.

Returns​

void

Inherited from​

AbstractSubscribableArray.notify


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<NearestSubscriptionFacilityType<InnerType>>>The destroyed subscription.

Returns​

void

Inherited from​

AbstractSubscribableArray.onSubDestroyed


start()​

start(): Promise<void>

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

Starts this search.

Returns​

Promise<void>

Implementation of​

NearestSubscription.start


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<NearestSubscriptionFacilityType<InnerType>>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): NearestSubscriptionFacilityType<InnerType> | undefined

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​

NearestSubscriptionFacilityType<InnerType> | undefined

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:727

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