Interface: MutableSubscribableMap<K, V>
A subscribable map which can accept inputs to add or remove key-value pairs.
Type parameters
Name |
---|
K |
V |
Hierarchy
SubscribableMap
<K
,V
>↳
MutableSubscribableMap
Implemented by
Properties
isMutableSubscribableMap
• Readonly
isMutableSubscribableMap: true
Flags this object as a MutableSubscribableMap.
Defined in
src/sdk/sub/SubscribableMap.ts:79
isSubscribableMap
• Readonly
isSubscribableMap: true
Flags this object as a SubscribableMap.
Inherited from
SubscribableMap.isSubscribableMap
Defined in
src/sdk/sub/SubscribableMap.ts:27
size
• Readonly
size: number
The number of elements contained in this map.
Inherited from
Defined in
src/sdk/sub/SubscribableMap.ts:30
Methods
clear
▸ clear(): void
Removes all key-value pairs from this map.
Returns
void
Defined in
src/sdk/sub/SubscribableMap.ts:100
delete
▸ delete(key
): boolean
Removes a key-value pair from this map.
Parameters
Name | Type | Description |
---|---|---|
key | K | The key to remove. |
Returns
boolean
Whether the key-value pair was removed.
Defined in
src/sdk/sub/SubscribableMap.ts:95
get
▸ get(): ReadonlyMap
<K
, V
>
Gets a read-only version of this map.
Returns
ReadonlyMap
<K
, V
>
A read-only version of this map.
Inherited from
Defined in
src/sdk/sub/SubscribableMap.ts:36
getValue
▸ getValue(key
): undefined
| V
Gets the value stored under a given key in this map.
Parameters
Name | Type | Description |
---|---|---|
key | K | The key under which the value to get is stored. |
Returns
undefined
| V
The value stored under the specified key in this map, or undefined
if this map does not contain the
specified key.
Inherited from
Defined in
src/sdk/sub/SubscribableMap.ts:51
has
▸ has(key
): boolean
Checks whether this map contains a key.
Parameters
Name | Type | Description |
---|---|---|
key | K | The key to check. |
Returns
boolean
Whether this map contains the specified key.
Inherited from
Defined in
src/sdk/sub/SubscribableMap.ts:43
pipe
▸ pipe(to
, paused?
): Subscription
Subscribes to and pipes this map's state to a mutable subscribable map. Whenever a key-value pair added, changed, or removed event is received through the subscription, the same key-value pair will be added to, changed, or removed from the other map.
Parameters
Name | Type | Description |
---|---|---|
to | MutableSubscribableMap <K , V > | The mutable subscribable map to which to pipe this map's state. |
paused? | boolean | Whether the new subscription should be initialized as paused. Defaults to false . |
Returns
The new subscription.
Inherited from
Defined in
src/sdk/sub/SubscribableMap.ts:71
setValue
▸ setValue(key
, value
): this
Adds a key-value pair to this map. If this map already contains the specified key, then the existing value stored under the key will be replaced with the new value.
Parameters
Name | Type | Description |
---|---|---|
key | K | The key to add. |
value | V | The value to add. |
Returns
this
This map, after the key-value pair has been added.
Defined in
src/sdk/sub/SubscribableMap.ts:88
sub
▸ sub(handler
, initialNotify?
, paused?
): Subscription
Subscribes to changes in this map's state.
Parameters
Name | Type | Description |
---|---|---|
handler | SubscribableMapHandler <K , V > | A function which is called when this map's state changes. |
initialNotify? | boolean | Whether to immediately invoke the callback function with this map's current state. Defaults to false . This argument is ignored if the subscription is initialized as paused. |
paused? | boolean | Whether the new subscription should be initialized as paused. Defaults to false . |
Returns
The new subscription.
Inherited from
Defined in
src/sdk/sub/SubscribableMap.ts:61