Class: FilteredMappedSubscribableArray<T>
Defined in: src/sdk/utils/datastructures/FilteredMappedSubscribableArray.ts:8
A subscribable which provides a filtered 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/FilteredMappedSubscribableArray.ts:13
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/FilteredMappedSubscribableArray.ts:156
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/FilteredMappedSubscribableArray.ts:148
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
setFilter()
setFilter(
filterFunc
):void
Defined in: src/sdk/utils/datastructures/FilteredMappedSubscribableArray.ts:75
Set a new filter for this array.
Parameters
Parameter | Type | Description |
---|---|---|
filterFunc | (a ) => boolean | The new filter function. |
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.
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
,filterFunc
):FilteredMappedSubscribableArray
<CT
>
Defined in: src/sdk/utils/datastructures/FilteredMappedSubscribableArray.ts:37
Public creation method for a new FilteredMappedSubscribableArray.
Type Parameters
Type Parameter |
---|
CT |
Parameters
Parameter | Type | Description |
---|---|---|
source | SubscribableArray <CT > | The source array subject for the new mapped array. |
filterFunc | (a ) => boolean | The filter function to use to prune members. Should return false for filtered-out elements. |
Returns
FilteredMappedSubscribableArray
<CT
>
A new SortedMappedSubscribableArray.