Skip to main content

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​

Type Parameters​

Type Parameter
T

Implements​

Constructors​

Constructor​

new AbstractSubscribableArray<T>(): AbstractSubscribableArray<T>

Returns​

AbstractSubscribableArray<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​

ParameterTypeDescription
subHandlerSubscription<SubscribableArrayHandler<T>>The subscription to notify.

Returns​

void


length​

abstract readonly length: number

Defined in: src/sdk/sub/AbstractSubscribableArray.ts:12

The length of this array.

Implementation of​

SubscribableArray.length


notifyDepth​

protected notifyDepth: number = 0

Defined in: src/sdk/sub/AbstractSubscribableArray.ts:17


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​

ParameterTypeDescription
subHandlerSubscription<SubscribableArrayHandler<T>>The destroyed subscription.

Returns​

void


singletonSub?​

protected optional singletonSub: HandlerSubscription<SubscribableArrayHandler<T>>

Defined in: src/sdk/sub/AbstractSubscribableArray.ts:14


subs?​

protected optional subs: HandlerSubscription<SubscribableArrayHandler<T>>[]

Defined in: src/sdk/sub/AbstractSubscribableArray.ts:16

Methods​

addSubscription()​

protected addSubscription(sub): void

Defined in: src/sdk/sub/AbstractSubscribableArray.ts:29

Adds a subscription to this array.

Parameters​

ParameterTypeDescription
subHandlerSubscription<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​

ParameterTypeDescription
indexnumberThex index of the item to get.

Returns​

T

An item.

Throws​

Implementation of​

SubscribableArray.get


getArray()​

abstract getArray(): readonly T[]

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​

SubscribableArray.getArray


initialNotify()​

protected initialNotify(sub): void

Defined in: src/sdk/sub/AbstractSubscribableArray.ts:163

Notifies a subscription of this array's current state.

Parameters​

ParameterTypeDescription
subHandlerSubscription<SubscribableArrayHandler<T>>The subscription to notify.

Returns​

void


notify()​

protected notify(index, type, modifiedItem?): void

Defined in: src/sdk/sub/AbstractSubscribableArray.ts:87

Notifies subscriptions of a change in the array.

Parameters​

ParameterTypeDescription
indexnumberThe index that was changed.
typeSubscribableArrayEventTypeThe type of subject event.
modifiedItem?T | readonly T[]The item modified by the operation.

Returns​

void


onSubDestroyed()​

protected onSubDestroyed(sub): void

Defined in: src/sdk/sub/AbstractSubscribableArray.ts:172

Responds to when a subscription to this array is destroyed.

Parameters​

ParameterTypeDescription
subHandlerSubscription<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​

ParameterTypeDefault valueDescription
handlerSubscribableArrayHandler<T>undefinedA function which is called when this array's state changes.
initialNotifybooleanfalseWhether 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.
pausedbooleanfalseWhether the new subscription should be initialized as paused. Defaults to false.

Returns​

Subscription

The new subscription.

Implementation of​

SubscribableArray.sub


tryGet()​

tryGet(index): T | undefined

Defined in: src/sdk/sub/AbstractSubscribableArray.ts:77

Tries to get the value from the array.

Parameters​

ParameterTypeDescription
indexnumberThe index of the item to get.

Returns​

T | undefined

The value or undefined if not found.

Implementation of​

SubscribableArray.tryGet