Interface: MutableSubscribableSet<T>
A subscribable set which can accept inputs to add or remove keys.
Type parameters
Name |
---|
T |
Hierarchy
↳
MutableSubscribableSet
Implemented by
Properties
isMutableSubscribableSet
• Readonly
isMutableSubscribableSet: true
Flags this object as a MutableSubscribableSet.
Defined in
src/sdk/sub/SubscribableSet.ts:79
isSubscribableSet
• Readonly
isSubscribableSet: true
Flags this object as a SubscribableSet.
Inherited from
SubscribableSet.isSubscribableSet
Defined in
src/sdk/sub/SubscribableSet.ts:24
size
• Readonly
size: number
The number of elements contained in this set.
Inherited from
Defined in
src/sdk/sub/SubscribableSet.ts:27
Methods
add
▸ add(key
): this
Adds a key to this set.
Parameters
Name | Type | Description |
---|---|---|
key | T | The key to add. |
Returns
this
This set, after the key has been added.
Defined in
src/sdk/sub/SubscribableSet.ts:86
clear
▸ clear(): void
Removes all keys from this set.
Returns
void
Defined in
src/sdk/sub/SubscribableSet.ts:114
delete
▸ delete(key
): boolean
Removes a key from this set.
Parameters
Name | Type | Description |
---|---|---|
key | T | The key to remove. |
Returns
boolean
Whether the key was removed.
Defined in
src/sdk/sub/SubscribableSet.ts:93
get
▸ get(): ReadonlySet
<T
>
Gets a read-only version of this set.
Returns
ReadonlySet
<T
>
A read-only version of this set.
Inherited from
Defined in
src/sdk/sub/SubscribableSet.ts:33
has
▸ has(key
): boolean
Checks whether this set contains a key.
Parameters
Name | Type | Description |
---|---|---|
key | T | The key to check. |
Returns
boolean
Whether this set contains the specified key.
Inherited from
Defined in
src/sdk/sub/SubscribableSet.ts:40
pipe
▸ pipe(to
, paused?
): Subscription
Subscribes to and pipes this set's state to a mutable subscribable set. Whenever a key added or removed event is received through the subscription, the same key will be added to or removed from the other set.
Parameters
Name | Type | Description |
---|---|---|
to | MutableSubscribableSet <T > | The mutable subscribable set to which to pipe this set'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/SubscribableSet.ts:59
▸ pipe<M
>(to
, map
, paused?
): Subscription
Subscribes to this set's state and pipes a mapped version to a mutable subscribable set. Whenever a key added event is received through the subscription, the key will be transformed by the specified mapping function, and the transformed key will be added to the other set. Whenever a key removed event is received, the transformed key is removed from the other set if and only if no remaining key in this set maps to the same transformed key.
Type parameters
Name |
---|
M |
Parameters
Name | Type | Description |
---|---|---|
to | MutableSubscribableSet <M > | The mutable subscribable to which to pipe this set's mapped state. |
map | (input : T ) => M | The function to use to transform keys. |
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/SubscribableSet.ts:71
sub
▸ sub(handler
, initialNotify?
, paused?
): Subscription
Subscribes to changes in this set's state.
Parameters
Name | Type | Description |
---|---|---|
handler | SubscribableSetHandler <T > | A function which is called when this set's state changes. |
initialNotify? | boolean | Whether to immediately invoke the callback function with this set'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/SubscribableSet.ts:50
toggle
▸ toggle(key
): boolean
Toggles the presence of a key in this set.
Parameters
Name | Type | Description |
---|---|---|
key | T | The key to toggle. |
Returns
boolean
Whether the key is present in this set after the toggle operation.
Defined in
src/sdk/sub/SubscribableSet.ts:101
▸ toggle(key
, force
): boolean
Toggles the presence of a key in this set.
Parameters
Name | Type | Description |
---|---|---|
key | T | The key to toggle. |
force | boolean | The state of the key to force. If true , the key will be added to this set. If false , the key will be removed from this set. |
Returns
boolean
Whether the key is present in this set after the toggle operation.
Defined in
src/sdk/sub/SubscribableSet.ts:109