Abstract Class: AbstractSubscribableArray<T>
Defined in: src/sdk/sub/AbstractSubscribableArray.ts:10
An array-like class to observe changes in a list of objects. ArraySubject
Extended by
ExistingUserWaypointsArrayAbstractNearestSubscriptionAdaptiveNearestSubscriptionArraySubjectSortedMappedSubscribableArrayFilteredMappedSubscribableArrayGarminExistingUserWaypointsArrayFlightPlannerFlightPlanDataArray
Type Parameters
| Type Parameter |
|---|
T |
Implements
Constructors
Constructor
new AbstractSubscribableArray<
T>():AbstractSubscribableArray<T>
Returns
AbstractSubscribableArray<T>
Properties
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
length
abstractreadonlylength:number
Defined in: src/sdk/sub/AbstractSubscribableArray.ts:12
The length of this array.
Implementation of
notifyDepth
protectednotifyDepth:number=0
Defined in: src/sdk/sub/AbstractSubscribableArray.ts:17
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
singletonSub?
protectedoptionalsingletonSub:HandlerSubscription<SubscribableArrayHandler<T>>
Defined in: src/sdk/sub/AbstractSubscribableArray.ts:14
subs?
protectedoptionalsubs:HandlerSubscription<SubscribableArrayHandler<T>>[]
Defined in: src/sdk/sub/AbstractSubscribableArray.ts:16
Methods
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
get()
get(
index):T
Defined in: src/sdk/sub/AbstractSubscribableArray.ts:64
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
getArray()
abstractgetArray(): readonlyT[]
Defined in: src/sdk/sub/AbstractSubscribableArray.ts:56
Gets a read-only version of this array.
Returns
readonly T[]
a read-only version of this array.
Implementation of
initialNotify()
protectedinitialNotify(sub):void
Defined in: src/sdk/sub/AbstractSubscribableArray.ts:163
Notifies a subscription of this array's current state.
Parameters
| Parameter | Type | Description |
|---|---|---|
sub | HandlerSubscription<SubscribableArrayHandler<T>> | The subscription to notify. |
Returns
void
notify()
protectednotify(index,type,modifiedItem?):void
Defined in: src/sdk/sub/AbstractSubscribableArray.ts:87
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
onSubDestroyed()
protectedonSubDestroyed(sub):void
Defined in: src/sdk/sub/AbstractSubscribableArray.ts:172
Responds to when a subscription to this array is destroyed.
Parameters
| Parameter | Type | Description |
|---|---|---|
sub | HandlerSubscription<SubscribableArrayHandler<T>> | The destroyed subscription. |
Returns
void
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
tryGet()
tryGet(
index):undefined|T
Defined in: src/sdk/sub/AbstractSubscribableArray.ts:77
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.