Abstract Class: AbstractNearestSubscription<T, TAdded, TRemoved>
Defined in: src/sdk/navigation/NearestSubscription.ts:57
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>(facilityLoader,type):AbstractNearestSubscription<T,TAdded,TRemoved>
Defined in: src/sdk/navigation/NearestSubscription.ts:75
Creates an instance of a NearestSubscription.
Parameters
| Parameter | Type | Description |
|---|---|---|
facilityLoader | FacilityLoader | An instance of the facility loader to search with. |
type | FacilitySearchType | The type of facility to search for. |
Returns
AbstractNearestSubscription<T, TAdded, TRemoved>
Overrides
AbstractSubscribableArray.constructor
Properties
facilities
protectedreadonlyfacilities:T[] =[]
Defined in: src/sdk/navigation/NearestSubscription.ts:58
facilityIndex
protectedreadonlyfacilityIndex:Map<TRemoved,T>
Defined in: src/sdk/navigation/NearestSubscription.ts:59
facilityLoader
protectedreadonlyfacilityLoader:FacilityLoader
Defined in: src/sdk/navigation/NearestSubscription.ts:75
An instance of the facility loader to search with.
initialNotifyFunc()
protectedreadonlyinitialNotifyFunc: (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
| Parameter | Type | Description |
|---|---|---|
sub | HandlerSubscription<SubscribableArrayHandler<T>> | The subscription to notify. |
Returns
void
Inherited from
AbstractSubscribableArray.initialNotifyFunc
notifyDepth
protectednotifyDepth:number=0
Defined in: src/sdk/sub/AbstractSubscribableArray.ts:17
Inherited from
AbstractSubscribableArray.notifyDepth
onSubDestroyedFunc()
protectedreadonlyonSubDestroyedFunc: (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
| Parameter | Type | Description |
|---|---|---|
sub | HandlerSubscription<SubscribableArrayHandler<T>> | The destroyed subscription. |
Returns
void
Inherited from
AbstractSubscribableArray.onSubDestroyedFunc
session
protectedsession:undefined|NearestSearchSession<TAdded,TRemoved>
Defined in: src/sdk/navigation/NearestSubscription.ts:61
singletonSub?
protectedoptionalsingletonSub:HandlerSubscription<SubscribableArrayHandler<T>>
Defined in: src/sdk/sub/AbstractSubscribableArray.ts:14
Inherited from
AbstractSubscribableArray.singletonSub
startPromiseResolves
protectedreadonlystartPromiseResolves: () =>void[] =[]
Defined in: src/sdk/navigation/NearestSubscription.ts:63
Returns
void
subs?
protectedoptionalsubs:HandlerSubscription<SubscribableArrayHandler<T>>[]
Defined in: src/sdk/sub/AbstractSubscribableArray.ts:16
Inherited from
AbstractSubscribableArray.subs
type
protectedreadonlytype:FacilitySearchType
Defined in: src/sdk/navigation/NearestSubscription.ts:75
The type of facility to search for.
updatePromiseResolves
protectedreadonlyupdatePromiseResolves: () =>void[] =[]
Defined in: src/sdk/navigation/NearestSubscription.ts:64
Returns
void
Accessors
length
Get Signature
get length():
number
Defined in: src/sdk/navigation/NearestSubscription.ts:80
The length of this array.
Returns
number
The length of this array.
Implementation of
Overrides
AbstractSubscribableArray.length
started
Get Signature
get started():
boolean
Defined in: src/sdk/navigation/NearestSubscription.ts:88
Whether or not this subscription has been started.
Returns
boolean
True if started, false otherwise.
Whether this search has started.
Implementation of
Methods
addFacility()
protectedaddFacility(facility,key):void
Defined in: src/sdk/navigation/NearestSubscription.ts:176
Adds a facility to the collection.
Parameters
| Parameter | Type | Description |
|---|---|---|
facility | T | The facility to add. |
key | TRemoved | The key to track this facility by. |
Returns
void
addSubscription()
protectedaddSubscription(sub):void
Defined in: src/sdk/sub/AbstractSubscribableArray.ts:29
Adds a subscription to this array.
Parameters
| Parameter | Type | Description |
|---|---|---|
sub | HandlerSubscription<SubscribableArrayHandler<T>> | The subscription to add. |
Returns
void
Inherited from
AbstractSubscribableArray.addSubscription
awaitStart()
awaitStart():
Promise<void>
Defined in: src/sdk/navigation/NearestSubscription.ts:98
Waits until this search has started.
Returns
Promise<void>
Implementation of
NearestSubscription.awaitStart
doUpdate()
protecteddoUpdate(lat,lon,radius,maxItems):Promise<void>
Defined in: src/sdk/navigation/NearestSubscription.ts:149
Executes an update of the nearest search subscription.
Parameters
| Parameter | Type | Description |
|---|---|---|
lat | number | The latitude of the current search position. |
lon | number | The longitude of the current search position. |
radius | number | The radius of the search, in meters. |
maxItems | number | The maximum number of items to return in the search. |
Returns
Promise<void>
get()
get(
index):T
Defined in: src/sdk/sub/AbstractSubscribableArray.ts:77
Gets an item from the array.
Parameters
| Parameter | Type | Description |
|---|---|---|
index | number | Thex index of the item to get. |
Returns
T
An item.
Throws
Implementation of
Inherited from
getArray()
getArray(): readonly
T[]
Defined in: src/sdk/navigation/NearestSubscription.ts:93
Gets a read-only version of this array.
Returns
readonly T[]
a read-only version of this array.
Implementation of
Overrides
AbstractSubscribableArray.getArray
initialNotify()
protectedinitialNotify(sub):void
Defined in: src/sdk/sub/AbstractSubscribableArray.ts:176
Notifies a subscription of this array's current state.
Parameters
| Parameter | Type | Description |
|---|---|---|
sub | HandlerSubscription<SubscribableArrayHandler<T>> | The subscription to notify. |
Returns
void
Inherited from
AbstractSubscribableArray.initialNotify
notify()
protectednotify(index,type,modifiedItem?):void
Defined in: src/sdk/sub/AbstractSubscribableArray.ts:100
Notifies subscriptions of a change in the array.
Parameters
| Parameter | Type | Description |
|---|---|---|
index | number | The index that was changed. |
type | SubscribableArrayEventType | The type of subject event. |
modifiedItem? | T | readonly T[] | The item modified by the operation. |
Returns
void
Inherited from
AbstractSubscribableArray.notify
onResults()
abstractprotectedonResults(results):Promise<void>
Defined in: src/sdk/navigation/NearestSubscription.ts:169
A callback called when results are received.
Parameters
| Parameter | Type | Description |
|---|---|---|
results | NearestSearchResults<TAdded, TRemoved> | The results that were received. |
Returns
Promise<void>
onSubDestroyed()
protectedonSubDestroyed(sub):void
Defined in: src/sdk/sub/AbstractSubscribableArray.ts:185
Responds to when a subscription to this array is destroyed.
Parameters
| Parameter | Type | Description |
|---|---|---|
sub | HandlerSubscription<SubscribableArrayHandler<T>> | The destroyed subscription. |
Returns
void
Inherited from
AbstractSubscribableArray.onSubDestroyed
removeFacility()
protectedremoveFacility(key):void
Defined in: src/sdk/navigation/NearestSubscription.ts:191
Removes a facility from the collection.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | TRemoved | The key of the facility to remove. |
Returns
void
start()
start():
Promise<void>
Defined in: src/sdk/navigation/NearestSubscription.ts:107
Returns
Promise<void>
Inherit Doc
Implementation of
sub()
sub(
handler,initialNotify,paused):Subscription
Defined in: src/sdk/sub/AbstractSubscribableArray.ts:41
Subscribes to changes in this array's state.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
handler | SubscribableArrayHandler<T> | undefined | A function which is called when this array's state changes. |
initialNotify | boolean | false | 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 | false | Whether the new subscription should be initialized as paused. Defaults to false. |
Returns
The new subscription.
Implementation of
Inherited from
tryGet()
tryGet(
index):undefined|T
Defined in: src/sdk/sub/AbstractSubscribableArray.ts:90
Tries to get the value from the array.
Parameters
| Parameter | Type | Description |
|---|---|---|
index | number | The index of the item to get. |
Returns
undefined | T
The value or undefined if not found.
Implementation of
Inherited from
AbstractSubscribableArray.tryGet
unsub()
unsub(
handler):void
Defined in: src/sdk/sub/AbstractSubscribableArray.ts:56
Unsubscribes a callback function from this array.
Parameters
| Parameter | 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.
Implementation of
Inherited from
AbstractSubscribableArray.unsub
update()
update(
lat,lon,radius,maxItems):Promise<void>
Defined in: src/sdk/navigation/NearestSubscription.ts:130
Parameters
| Parameter | 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.