Class: SortedMappedSubscribableArray<T>
Defined in: src/sdk/utils/datastructures/SortedMappedSubscribableArray.ts:9
A subscribable which provides a sorted version of a source SubscribableArray.
Extends
Type Parameters
Type Parameter |
---|
T |
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
Parameter | Type | Description |
---|---|---|
sub | HandlerSubscription <SubscribableArrayHandler <T >> | The subscription to notify. |
Returns
void
Inherited from
AbstractSubscribableArray
.initialNotifyFunc
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
Parameter | Type | Description |
---|---|---|
sub | HandlerSubscription <SubscribableArrayHandler <T >> | The destroyed subscription. |
Returns
void
Inherited from
AbstractSubscribableArray
.onSubDestroyedFunc
singletonSub?
protected
optional
singletonSub:HandlerSubscription
<SubscribableArrayHandler
<T
>>
Defined in: src/sdk/sub/AbstractSubscribableArray.ts:14
Inherited from
AbstractSubscribableArray
.singletonSub
subs?
protected
optional
subs:HandlerSubscription
<SubscribableArrayHandler
<T
>>[]
Defined in: src/sdk/sub/AbstractSubscribableArray.ts:16
Inherited from
AbstractSubscribableArray
.subs
Accessors
length
Get Signature
get length():
number
Defined in: src/sdk/utils/datastructures/SortedMappedSubscribableArray.ts:14
The length of this array.
Returns
number
The length of this array.
Overrides
AbstractSubscribableArray
.length
Methods
addSubscription()
protected
addSubscription(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
destroy()
destroy():
void
Defined in: src/sdk/utils/datastructures/SortedMappedSubscribableArray.ts:136
Destroys this subscribable. After destruction, this subscribable will no longer update in response to changes made to its source.
Returns
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
Inherited from
getArray()
getArray(): readonly
T
[]
Defined in: src/sdk/utils/datastructures/SortedMappedSubscribableArray.ts:128
Gets a read-only version of this array.
Returns
readonly T
[]
a read-only version of this array.
Overrides
AbstractSubscribableArray
.getArray
initialNotify()
protected
initialNotify(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()
protected
notify(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
onSubDestroyed()
protected
onSubDestroyed(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
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.
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.
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.
Inherited from
AbstractSubscribableArray
.unsub
create()
static
create<CT
>(source
,comparatorFunc
,equalityFunc?
):SortedMappedSubscribableArray
<CT
>
Defined in: src/sdk/utils/datastructures/SortedMappedSubscribableArray.ts:47
Creates a new SortedMappedSubscribableArray.
Type Parameters
Type Parameter |
---|
CT |
Parameters
Parameter | Type | Description |
---|---|---|
source | SubscribableArray <CT > | The source array subject for the new mapped sorted array. |
comparatorFunc | (a , b ) => number | A function which defines the relative sorting priority of two elements. The function should return 0 if its arguments are to be sorted identically, a negative number if the first argument is to be sorted before the second argument, and a positive number if the first argument is to be sorted after the second argument. |
equalityFunc? | (a , b ) => boolean | A function which checks if two elements are equal. Defaults to the strict equality comparison (=== ) if not defined. |
Returns
SortedMappedSubscribableArray
<CT
>
A new SortedMappedSubscribableArray.