Interface: NearestSubscription<T>
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.
Type parameters
Name | Type |
---|---|
T | extends Facility |
Hierarchy
↳
NearestSubscription
Implemented by
Properties
length
• Readonly
length: number
The length of this array.
Inherited from
Defined in
src/sdk/sub/SubscribableArray.ts:27
start
• start: () => Promise
<void
>
Starts this search.
Type declaration
▸ (): Promise
<void
>
Starts this search.
Returns
Promise
<void
>
Defined in
src/sdk/navigation/NearestSubscription.ts:40
started
• Readonly
started: boolean
Whether this search has started.
Defined in
src/sdk/navigation/NearestSubscription.ts:36
update
• update: (lat
: number
, lon
: number
, radius
: number
, maxItems
: number
) => Promise
<void
>
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.
Param
The latitude, in degrees, of the center of the search.
Param
The longitude, in degrees, of the center of the search.
Param
The radius of the search, in meters.
Param
The maximum number of items to return from the search.
Type declaration
▸ (lat
, lon
, radius
, maxItems
): Promise
<void
>
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
Name | Type | Description |
---|---|---|
lat | number | The latitude, in degrees, of the center of the search. |
lon | number | The longitude, in degrees, of the center of the search. |
radius | number | The radius of the search, in meters. |
maxItems | number | The maximum number of items to return from the search. |
Returns
Promise
<void
>
A Promise which will be fulfilled when the update is complete.
Defined in
src/sdk/navigation/NearestSubscription.ts:50
Methods
awaitStart
▸ awaitStart(): Promise
<void
>
Waits until this search has started.
Returns
Promise
<void
>
Defined in
src/sdk/navigation/NearestSubscription.ts:38
get
▸ get(index
): T
Retrieves an element from this array.
Parameters
Name | Type | Description |
---|---|---|
index | number | The index of the element. |
Returns
T
the element at the specified index.
Throws
Error if index is out of bounds.
Inherited from
Defined in
src/sdk/sub/SubscribableArray.ts:35
getArray
▸ getArray(): readonly T
[]
Gets a read-only version of this array.
Returns
readonly T
[]
a read-only version of this array.
Inherited from
Defined in
src/sdk/sub/SubscribableArray.ts:48
sub
▸ sub(handler
, initialNotify?
, paused?
): Subscription
Subscribes to changes in this array's state.
Parameters
Name | Type | Description |
---|---|---|
handler | SubscribableArrayHandler <T > | A function which is called when this array's state changes. |
initialNotify? | boolean | Whether 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? | boolean | Whether the new subscription should be initialized as paused. Defaults to false . |
Returns
The new subscription.
Inherited from
Defined in
src/sdk/sub/SubscribableArray.ts:58
tryGet
▸ tryGet(index
): undefined
| T
Attempts to retrieve an element from this array.
Parameters
Name | Type | Description |
---|---|---|
index | number | The index of the element. |
Returns
undefined
| T
the element at the specified index, or undefined if index is out of bounds.
Inherited from
Defined in
src/sdk/sub/SubscribableArray.ts:42
unsub
▸ unsub(handler
): void
Unsubscribes a callback function from this array.
Parameters
Name | Type | Description |
---|---|---|
handler | SubscribableArrayHandler <T > | The function to unsubscribe. |
Returns
void
Deprecated
This method has been deprecated in favor of using the Subscription object returned by .sub()
to manage subscriptions.
Inherited from
Defined in
src/sdk/sub/SubscribableArray.ts:66