Skip to main content

Interface: NearestSubscription<T>

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

A nearest search which provides its search results as an array of facilities. The contents of the array are automatically updated when the search is updated.

Extends​

Type Parameters​

Type Parameter
T extends Facility

Properties​

length​

readonly length: number

Defined in: src/sdk/sub/SubscribableArray.ts:27

The length of this array.

Inherited from​

SubscribableArray.length


started​

readonly started: boolean

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

Whether this search has started.

Methods​

awaitStart()​

awaitStart(): Promise<void>

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

Waits until this search has started.

Returns​

Promise<void>


get()​

get(index): T

Defined in: src/sdk/sub/SubscribableArray.ts:35

Retrieves an element from this array.

Parameters​

ParameterTypeDescription
indexnumberThe index of the element.

Returns​

T

the element at the specified index.

Throws​

Error if index is out of bounds.

Inherited from​

SubscribableArray.get


getArray()​

getArray(): readonly T[]

Defined in: src/sdk/sub/SubscribableArray.ts:48

Gets a read-only version of this array.

Returns​

readonly T[]

a read-only version of this array.

Inherited from​

SubscribableArray.getArray


start()​

start(): Promise<void>

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

Starts this search.

Returns​

Promise<void>


sub()​

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

Defined in: src/sdk/sub/SubscribableArray.ts:58

Subscribes to changes in this array's state.

Parameters​

ParameterTypeDescription
handlerSubscribableArrayHandler<T>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.

Inherited from​

SubscribableArray.sub


tryGet()​

tryGet(index): T | undefined

Defined in: src/sdk/sub/SubscribableArray.ts:42

Attempts to retrieve an element from this array.

Parameters​

ParameterTypeDescription
indexnumberThe index of the element.

Returns​

T | undefined

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

Inherited from​

SubscribableArray.tryGet


update()​

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

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

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.